calendar: speed up >gmt.

db4
John Benediktsson 2012-07-16 17:28:49 -07:00
parent eb87558b6a
commit 3b774c395e
1 changed files with 9 additions and 1 deletions

View File

@ -309,7 +309,15 @@ GENERIC: time- ( time1 time2 -- time3 )
gmt-offset-duration convert-timezone ; gmt-offset-duration convert-timezone ;
: >gmt ( timestamp -- timestamp' ) : >gmt ( timestamp -- timestamp' )
instant convert-timezone ; dup gmt-offset>> dup instant =
[ drop ] [
[ neg +second 0 ] change-second
[ neg +minute 0 ] change-minute
[ neg +hour 0 ] change-hour
[ neg +day 0 ] change-day
[ neg +month 0 ] change-month
[ neg +year 0 ] change-year drop
] if ;
M: timestamp <=> ( ts1 ts2 -- n ) M: timestamp <=> ( ts1 ts2 -- n )
[ >gmt tuple-slots ] compare ; [ >gmt tuple-slots ] compare ;