From 3b774c395ea951b6320358169e7568ea17a554af Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 16 Jul 2012 17:28:49 -0700 Subject: [PATCH] calendar: speed up >gmt. --- basis/calendar/calendar.factor | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/basis/calendar/calendar.factor b/basis/calendar/calendar.factor index 42b5a2f3fb..7a309c306a 100644 --- a/basis/calendar/calendar.factor +++ b/basis/calendar/calendar.factor @@ -309,7 +309,15 @@ GENERIC: time- ( time1 time2 -- time3 ) gmt-offset-duration convert-timezone ; : >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 ) [ >gmt tuple-slots ] compare ;