Merge branch 'master' of git://factorcode.org/git/factor
commit
2b8f2b3589
|
@ -1 +0,0 @@
|
||||||
Doug Coleman
|
|
|
@ -1,4 +0,0 @@
|
||||||
USING: kernel system ;
|
|
||||||
IN: calendar.backend
|
|
||||||
|
|
||||||
HOOK: gmt-offset os ( -- hours minutes seconds )
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays kernel math strings help.markup help.syntax
|
USING: arrays kernel math strings help.markup help.syntax
|
||||||
calendar.backend math.order ;
|
math.order ;
|
||||||
IN: calendar
|
IN: calendar
|
||||||
|
|
||||||
HELP: duration
|
HELP: duration
|
||||||
|
@ -278,8 +278,6 @@ HELP: time-
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
{ time+ time- } related-words
|
|
||||||
|
|
||||||
HELP: convert-timezone
|
HELP: convert-timezone
|
||||||
{ $values { "timestamp" timestamp } { "duration" duration } { "timestamp" timestamp } }
|
{ $values { "timestamp" timestamp } { "duration" duration } { "timestamp" timestamp } }
|
||||||
{ $description "Converts the " { $snippet "timestamp" } "'s " { $snippet "gmt-offset" } " to the GMT offset represented by the " { $snippet "duration" } "." }
|
{ $description "Converts the " { $snippet "timestamp" } "'s " { $snippet "gmt-offset" } " to the GMT offset represented by the " { $snippet "duration" } "." }
|
||||||
|
@ -299,3 +297,28 @@ HELP: >local-time
|
||||||
"t"
|
"t"
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
HELP: >gmt
|
||||||
|
{ $values { "timestamp" timestamp } { "timestamp" timestamp } }
|
||||||
|
{ $description "Converts the " { $snippet "timestamp" } " to the GMT timezone." }
|
||||||
|
{ $examples
|
||||||
|
{ $example "USING: accessors calendar kernel prettyprint ;"
|
||||||
|
"now >gmt gmt-offset>> hour>> ."
|
||||||
|
"0"
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
HELP: time*
|
||||||
|
{ $values { "obj1" object } { "obj2" object } { "obj3" object } }
|
||||||
|
{ $description "Multiplies each time slot of a timestamp or duration by a number and make a new duration from the result. Used in the implementation of " { $link before } "." } ;
|
||||||
|
{ time+ time- time* } related-words
|
||||||
|
|
||||||
|
HELP: before
|
||||||
|
{ $values { "duration" duration } { "-duration" duration } }
|
||||||
|
{ $description "Negates a duration." }
|
||||||
|
{ $examples
|
||||||
|
{ $example "USING: accessors calendar prettyprint ;"
|
||||||
|
"3 hours before now noon time+ hour>> ."
|
||||||
|
"9"
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
! Copyright (C) 2007 Doug Coleman.
|
! Copyright (C) 2007 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays kernel math math.functions namespaces sequences
|
USING: arrays kernel math math.functions namespaces sequences
|
||||||
strings system vocabs.loader calendar.backend threads
|
strings system vocabs.loader threads accessors combinators
|
||||||
accessors combinators locals classes.tuple math.order
|
locals classes.tuple math.order summary
|
||||||
memoize summary combinators.short-circuit ;
|
combinators.short-circuit ;
|
||||||
IN: calendar
|
IN: calendar
|
||||||
|
|
||||||
|
HOOK: gmt-offset os ( -- hours minutes seconds )
|
||||||
|
|
||||||
TUPLE: duration
|
TUPLE: duration
|
||||||
{ year real }
|
{ year real }
|
||||||
{ month real }
|
{ month real }
|
||||||
|
@ -304,14 +306,14 @@ M: timestamp time-
|
||||||
M: duration time-
|
M: duration time-
|
||||||
before time+ ;
|
before time+ ;
|
||||||
|
|
||||||
MEMO: <zero> ( -- timestamp )
|
: <zero> ( -- timestamp )
|
||||||
0 0 0 0 0 0 instant <timestamp> ;
|
0 0 0 0 0 0 instant <timestamp> ;
|
||||||
|
|
||||||
: valid-timestamp? ( timestamp -- ? )
|
: valid-timestamp? ( timestamp -- ? )
|
||||||
clone instant >>gmt-offset
|
clone instant >>gmt-offset
|
||||||
dup <zero> time- <zero> time+ = ;
|
dup <zero> time- <zero> time+ = ;
|
||||||
|
|
||||||
MEMO: unix-1970 ( -- timestamp )
|
: unix-1970 ( -- timestamp )
|
||||||
1970 1 1 0 0 0 instant <timestamp> ;
|
1970 1 1 0 0 0 instant <timestamp> ;
|
||||||
|
|
||||||
: millis>timestamp ( n -- timestamp )
|
: millis>timestamp ( n -- timestamp )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: alien alien.c-types arrays calendar.backend
|
USING: alien alien.c-types arrays calendar kernel structs
|
||||||
kernel structs math unix.time namespaces system ;
|
math unix.time namespaces system ;
|
||||||
IN: calendar.unix
|
IN: calendar.unix
|
||||||
|
|
||||||
: get-time ( -- alien )
|
: get-time ( -- alien )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: calendar.backend namespaces alien.c-types system
|
USING: calendar namespaces alien.c-types system windows
|
||||||
windows windows.kernel32 kernel math combinators ;
|
windows.kernel32 kernel math combinators ;
|
||||||
IN: calendar.windows
|
IN: calendar.windows
|
||||||
|
|
||||||
M: windows gmt-offset ( -- hours minutes seconds )
|
M: windows gmt-offset ( -- hours minutes seconds )
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Doug Coleman
|
|
|
@ -1,4 +0,0 @@
|
||||||
USING: io.backend ;
|
|
||||||
IN: editors.gvim.backend
|
|
||||||
|
|
||||||
HOOK: gvim-path io-backend ( -- path )
|
|
|
@ -1 +0,0 @@
|
||||||
unportable
|
|
|
@ -1,10 +1,12 @@
|
||||||
USING: io.backend io.files kernel math math.parser
|
USING: io.backend io.files kernel math math.parser
|
||||||
namespaces sequences system combinators
|
namespaces sequences system combinators
|
||||||
editors.vim editors.gvim.backend vocabs.loader ;
|
editors.vim vocabs.loader ;
|
||||||
IN: editors.gvim
|
IN: editors.gvim
|
||||||
|
|
||||||
SINGLETON: gvim
|
SINGLETON: gvim
|
||||||
|
|
||||||
|
HOOK: gvim-path io-backend ( -- path )
|
||||||
|
|
||||||
M: gvim vim-command ( file line -- string )
|
M: gvim vim-command ( file line -- string )
|
||||||
[ gvim-path , swap , "+" swap number>string append , ] { } make ;
|
[ gvim-path , swap , "+" swap number>string append , ] { } make ;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
USING: io.unix.backend kernel namespaces editors.gvim.backend
|
USING: io.unix.backend kernel namespaces editors.gvim
|
||||||
system ;
|
system ;
|
||||||
IN: editors.gvim.unix
|
IN: editors.gvim.unix
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
USING: editors.gvim.backend io.files io.windows kernel namespaces
|
USING: editors.gvim io.files io.windows kernel namespaces
|
||||||
sequences windows.shell32 io.paths system ;
|
sequences windows.shell32 io.paths system ;
|
||||||
IN: editors.gvim.windows
|
IN: editors.gvim.windows
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue