parent
0f2aa053d9
commit
1785c6877b
25 changed files with 127 additions and 126 deletions
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
|
||||
## This module contains routines and types for dealing with time.
|
||||
## This module is available for the ECMAScript target.
|
||||
## This module is available for the JavaScript target.
|
||||
|
||||
{.push debugger:off.} # the user does not want to trace a part
|
||||
# of the standard library!
|
||||
|
|
@ -58,7 +58,7 @@ elif defined(windows):
|
|||
type
|
||||
TTime* = distinct TTimeImpl
|
||||
|
||||
elif defined(ECMAScript):
|
||||
elif defined(JS):
|
||||
type
|
||||
TTime* {.final, importc.} = object
|
||||
getDay: proc (): int
|
||||
|
|
@ -115,7 +115,7 @@ type
|
|||
weekday*: TWeekDay ## The current day of the week.
|
||||
yearday*: range[0..365] ## The number of days since January 1,
|
||||
## in the range 0 to 365.
|
||||
## Always 0 if the target is ECMAScript.
|
||||
## Always 0 if the target is JS.
|
||||
isDST*: bool ## Determines whether DST is in effect. Always
|
||||
## ``False`` if time is UTC.
|
||||
tzname*: string ## The timezone this time is in. E.g. GMT
|
||||
|
|
@ -246,7 +246,7 @@ proc `-`*(a: TTimeInfo, interval: TTimeInterval): TTimeInfo =
|
|||
else:
|
||||
result = getLocalTime(TTime(float(t) - secs))
|
||||
|
||||
when not defined(ECMAScript):
|
||||
when not defined(JS):
|
||||
proc epochTime*(): float {.rtl, extern: "nt$1", tags: [FTime].}
|
||||
## gets time after the UNIX epoch (1970) in seconds. It is a float
|
||||
## because sub-second resolution is likely to be supported (depending
|
||||
|
|
@ -265,7 +265,7 @@ when not defined(ECMAScript):
|
|||
## doWork()
|
||||
## echo "CPU time [s] ", cpuTime() - t0
|
||||
|
||||
when not defined(ECMAScript):
|
||||
when not defined(JS):
|
||||
|
||||
# C wrapper:
|
||||
type
|
||||
|
|
@ -694,4 +694,4 @@ when isMainModule:
|
|||
var t4 = getGMTime(TTime(876124714)) # Mon 6 Oct 08:58:34 BST 1997
|
||||
assert t4.format("M MM MMM MMMM") == "10 10 Oct October"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue