]> gitweb.factorcode.org Git - factor.git/commitdiff
calendar feature
authorerg <erg@trifocus.net>
Tue, 29 Aug 2006 00:36:04 +0000 (00:36 +0000)
committererg <erg@trifocus.net>
Tue, 29 Aug 2006 00:36:04 +0000 (00:36 +0000)
contrib/calendar/calendar.factor

index a877b0b26bdc4cfeeee324284e6d21607206db49..6d2067d32b7b7b242aff78cd37dca549a853da48 100644 (file)
@@ -200,9 +200,15 @@ M: number +second ( timestamp n -- timestamp )
 : >gmt ( timestamp -- timestamp )
     0 convert-timezone ;
 
+: unix-1970
+    1970 1 1 0 0 0 0 <timestamp> ;
+
+: unix>gmt ( n -- timestamp )
+    unix-1970 swap seconds +dt ; 
+
 : gmt ( -- timestamp )
     #! GMT time, right now
-    1970 1 1 0 0 0 0 <timestamp> millis 1000 /f seconds +dt ; 
+    unix-1970 millis 1000 /f seconds +dt ; 
 
 : timestamp- ( timestamp timestamp -- dt )
     [ >gmt time>array ] 2apply v- array>dt ;