pub struct Clock { /* private fields */ }Expand description
The clock of a validation (ValidateOptions::clock): the implicit timezone and the
value of fn:current-dateTime().
The clock of an evaluation: the implicit timezone and the value of
fn:current-dateTime(). Both are inputs: the evaluator never reads a clock itself, and
the current date and time stays the same for every evaluation made with the clock, as
Saxon reads its clock once per transformation.
Clock::system reads the system clock on the targets that have one; elsewhere, such
as wasm32-unknown-unknown, the host gives the time it reads, for instance with
Clock::from_unix_millis and JavaScript’s Date.now().
Implementations§
Source§impl Clock
impl Clock
Sourcepub fn new(
implicit_timezone: i16,
current_date_time: DateTime,
) -> Result<Clock, Error>
pub fn new( implicit_timezone: i16, current_date_time: DateTime, ) -> Result<Clock, Error>
The implicit timezone, in minutes east of UTC (Saxon takes the JVM’s), and the value
of fn:current-dateTime(), returned as given.
§Errors
An offset beyond ±14:00, or a date and time without a timezone (the current date and time always has one).
Sourcepub fn from_unix_millis(
implicit_timezone: i16,
millis: i64,
) -> Result<Clock, Error>
pub fn from_unix_millis( implicit_timezone: i16, millis: i64, ) -> Result<Clock, Error>
The implicit timezone, in minutes east of UTC, and the instant millis
milliseconds after the Unix epoch (1970-01-01T00:00:00Z) as the current date and
time, expressed in that timezone.
§Errors
An offset beyond ±14:00, or an instant beyond the supported dates.
Sourcepub fn system(implicit_timezone: i16) -> Result<Clock, Error>
pub fn system(implicit_timezone: i16) -> Result<Clock, Error>
The implicit timezone, in minutes east of UTC, and the current reading of the
system clock, expressed in that timezone. Not available on
wasm32-unknown-unknown, which has no clock.
§Errors
An offset beyond ±14:00, or a system clock beyond the supported dates.
Sourcepub const fn implicit_timezone(&self) -> i16
pub const fn implicit_timezone(&self) -> i16
The implicit timezone in minutes.
Sourcepub const fn current_date_time(&self) -> DateTime
pub const fn current_date_time(&self) -> DateTime
The value of fn:current-dateTime().