next node: UnixFailures,
prev node: ProcessInterrupt,
up to node: Subsystem Unix


Time

Signature of Time

List of Import References :
See BOOL
See Com
See DENOTATION
See Nat
See Option
See Real
See Seq
See Void

SIGNATURE Time

$Date: 2010-09-30 18:24:17 +0200 (Do, 30. Sep 2010) $ ($Revision: 616 $)

-- low-level access to system time

IMPORT
  Option[bool]        ONLY option: SORT
  Nat                 ONLY nat: SORT
  Com[time]           ONLY com: SORT
  Real                ONLY real: SORT

SORT time

TYPE wday == sun mon tue wed thu fri sat

FUN time: com[time]
          -- get system time
          -- see POSIX time()
          -- NOTE: value is time zone independent
          -- "94/05/13 09:01:38 MET DST" - "94/05/13 08:01:38 GMT DST" = 0.0

FUN < <= = |= >= > : time ** time -> bool
                     -- orderings

FUN - : time ** time -> real
        -- difference in seconds
        -- see POSIX difftime()

FUN < = : wday ** wday -> bool
          -- orderings

-- NOTE: the following functions interpret the given time value
--       as local time depending on the time zone
-- see POSIX localtime()

FUN sec                           -- 0 - 61 (allows for two leap seconds)
    min                           -- 0 - 59
    hour : time -> nat            -- 0 - 23
    -- get (local) time components

FUN day                           -- 1 - 31
    mon                           -- 1 - 12
    year : time -> nat            -- e.g. 1994
    -- get (local) date components

FUN wday : time -> wday
    -- get (local) day of week

FUN yday : time -> nat            -- 1 - 366
    -- get (local) day of year

FUN dst? : time -> option[bool]   -- sometimes not available
    -- daylight savings time?


next node: UnixFailures,
prev node: ProcessInterrupt,
up to node: Subsystem Unix