summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xlib/pure/times.nim10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim
index 6a73303d9..b86c72ed3 100755
--- a/lib/pure/times.nim
+++ b/lib/pure/times.nim
@@ -33,6 +33,7 @@ when defined(posix):
   type
     TTimeImpl {.importc: "time_t", header: "<sys/time.h>".} = int
     TTime* = distinct TTimeImpl ## distinct type that represents a time
+                                ## measured as number of seconds since the epoch
     
     Ttimeval {.importc: "struct timeval", header: "<sys/select.h>", 
                final, pure.} = object ## struct timeval
@@ -132,7 +133,10 @@ type
     months*: int      ## The number of months
     years*: int       ## The number of years
 
-proc getTime*(): TTime {.tags: [FTime].} ## gets the current calendar time
+proc getTime*(): TTime {.tags: [FTime].}
+  ## gets the current calendar time as a UNIX epoch value (number of seconds
+  ## elapsed since 1970) with integer precission. Use epochTime for higher
+  ## resolution.
 proc getLocalTime*(t: TTime): TTimeInfo
   ## converts the calendar time `t` to broken-time representation,
   ## expressed relative to the user's specified time zone.
@@ -165,6 +169,10 @@ proc `<=` * (a, b: TTime): bool {.
   ## returns true iff ``a <= b``.
   result = a - b <= 0
 
+proc `==`*(a, b: TTime): bool {.rtl, extern: "ntEqTime".} =
+  ## returns true if ``a == b``, that is if both times represent the same value
+  result = a - b == 0
+
 proc getTzname*(): tuple[nonDST, DST: string] {.tags: [FTime].}
   ## returns the local timezone; ``nonDST`` is the name of the local non-DST
   ## timezone, ``DST`` is the name of the local DST timezone.