Next: , Previous: , Up: Date and Time   [Contents][Index]


15.5.2 Decoded Time

Objects representing standard time components, such as seconds and minutes, are required to be exact non-negative integers. Seconds and minutes must be inclusively between 0 and 59; hours between 0 and 23; days between 1 and 31; months between 1 and 12; years are represented in “four-digit” form, in which 1999 is represented as 1999not 99.

procedure: local-decoded-time

Return the current time in decoded format. The decoded time is represented in the local time zone.

(pp (local-decoded-time))
-| #[decoded-time 76]
-| (second 2)
-| (minute 12)
-| (hour 11)
-| (day 27)
-| (month 4)
-| (year 1999)
-| (day-of-week 1)
-| (daylight-savings-time 1)
-| (zone 5)
procedure: global-decoded-time

Return the current time in decoded format. The decoded time is represented in UTC.

(pp (global-decoded-time))
-| #[decoded-time 77]
-| (second 8)
-| (minute 12)
-| (hour 15)
-| (day 27)
-| (month 4)
-| (year 1999)
-| (day-of-week 1)
-| (daylight-savings-time 0)
-| (zone 0)
procedure: make-decoded-time second minute hour day month year [zone]

Return a new decoded-time object representing the given time. The arguments must be valid components according to the above rules, and must form a valid date.

If zone is not supplied or is #f, the resulting decoded time will be represented in the local time zone. Otherwise, zone must be a valid time zone, and the result will be represented in that zone.

Warning: because this procedure depends on the operating system’s runtime library, it is not capable of representing all dates. In particular, on most unix systems, it is not possible to encode dates that occur prior to midnight, January 1, 1970 UTC. Attempting to do this will signal an error.

(pp (make-decoded-time 0 9 11 26 3 1999))
-| #[decoded-time 19]
-| (second 0)
-| (minute 9)
-| (hour 11)
-| (day 26)
-| (month 3)
-| (year 1999)
-| (day-of-week 4)
-| (daylight-savings-time 0)
-| (zone 5)

(pp (make-decoded-time 0 9 11 26 3 1999 3))
-| #[decoded-time 80]
-| (second 0)
-| (minute 9)
-| (hour 11)
-| (day 26)
-| (month 3)
-| (year 1999)
-| (day-of-week 4)
-| (daylight-savings-time 0)
-| (zone 3)
procedure: decoded-time/second decoded-time
procedure: decoded-time/minute decoded-time
procedure: decoded-time/hour decoded-time
procedure: decoded-time/day decoded-time
procedure: decoded-time/month decoded-time
procedure: decoded-time/year decoded-time

Return the corresponding component of decoded-time.

(decoded-time/second (local-decoded-time)) ⇒ 17
(decoded-time/year (local-decoded-time)) ⇒ 1999
(decoded-time/day (local-decoded-time)) ⇒ 26
procedure: decoded-time/day-of-week decoded-time

Return the day of the week on which decoded-time falls, encoded as an exact integer between 0 (Monday) and 6 (Sunday), inclusive.

(decoded-time/day-of-week (local-decoded-time)) ⇒ 4
procedure: decoded-time/daylight-savings-time? decoded-time

Return #t if decoded-time is represented using daylight savings time. Otherwise return #f.

(decoded-time/daylight-savings-time? (local-decoded-time))
                  ⇒ #f
procedure: decoded-time/zone decoded-time

Return the time zone in which decoded-time is represented. This is an exact rational number between -24 and +24 inclusive, that when multiplied by 3600 is an integer. The value is the number of hours west of UTC.

(decoded-time/zone (local-decoded-time)) ⇒ 5
procedure: time-zone? object

Returns #t if object is an exact number between -24 and +24 inclusive, that when multiplied by 3600 is an integer.

(time-zone? -5)   ⇒ #t
(time-zone? 11/2) ⇒ #t
(time-zone? 11/7) ⇒ #f
procedure: month/max-days month

Returns the maximum number of days possible in month. Month must be an exact integer between 1 and 12 inclusive.

(month/max-days 2) ⇒ 29
(month/max-days 3) ⇒ 31
(month/max-days 4) ⇒ 30

Next: , Previous: , Up: Date and Time   [Contents][Index]