timestamp
Calendar
Next:duration


Vocabulary
calendar

Word description
A timestamp is a date and a time with a timezone offset. Timestamp slots must store integers except for seconds, which stores reals, and gmt-offset, which stores a duration. Compare two durations with the <=> word.

See also
duration

Definition
USING: math ;

IN: calendar

TUPLE: timestamp
{ year integer initial: 0 } { month integer initial: 0 }
{ day integer initial: 0 } { hour integer initial: 0 }
{ minute integer initial: 0 } { second real initial: 0 }
{ gmt-offset duration initial: T{ duration } } ;


Methods
USING: calendar classes.tuple math.order ;

M: timestamp <=> [ >gmt tuple-slots ] compare ;


USING: accessors calendar kernel ;

M: timestamp april clone 4 >>month ;


USING: accessors calendar kernel ;

M: timestamp august clone 8 >>month ;


USING: accessors calendar ;

M: timestamp beginning-of-year beginning-of-month 1 >>month ;


USING: calendar sequences ;

M: timestamp day-name day-of-week day-names nth ;


USING: accessors calendar calendar.format ;

M: timestamp day. day>> day. ;


USING: accessors calendar ;

M: timestamp days-in-year year>> days-in-year ;


USING: accessors calendar kernel ;

M: timestamp december clone 12 >>month ;


USING: accessors calendar kernel ;

M: timestamp easter
clone dup year>> easter-month-day swapd >>day swap >>month
;


USING: accessors calendar ;

M: timestamp end-of-year 12 >>month 31 >>day ;


USING: accessors calendar kernel ;

M: timestamp february clone 2 >>month ;


USING: accessors calendar kernel ;

M: timestamp january clone 1 >>month ;


USING: accessors calendar kernel ;

M: timestamp july clone 7 >>month ;


USING: accessors calendar kernel ;

M: timestamp june clone 6 >>month ;


USING: accessors calendar ;

M: timestamp leap-year? year>> leap-year? ;


USING: calendar calendar.format logging.parser ;

M: timestamp log-timestamp. (timestamp>string) ;


USING: accessors calendar kernel ;

M: timestamp march clone 3 >>month ;


USING: accessors calendar kernel ;

M: timestamp may clone 5 >>month ;


USING: accessors calendar math sequences ;

M: timestamp month-name month>> 1 - month-names nth ;


USING: accessors arrays calendar calendar.format kernel ;

M: timestamp month. [ year>> ] [ month>> ] bi 2array month. ;


USING: accessors calendar kernel ;

M: timestamp november clone 11 >>month ;


USING: accessors calendar kernel ;

M: timestamp october clone 10 >>month ;


USING: calendar calendar.format present ;

M: timestamp present timestamp>string ;


USING: accessors calendar kernel ;

M: timestamp september clone 9 >>month ;


USING: calendar calendar.private kernel ;

M: timestamp time+ [ clone ] dip (time+) drop ;


USING: calendar ;

M: timestamp time- (time-) seconds ;


USING: accessors calendar calendar.format ;

M: timestamp year. year>> year. ;