summary refs log tree commit diff stats
path: root/lib/pure/times.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure/times.nim')
-rwxr-xr-xlib/pure/times.nim8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim
index da23d4615..378d6ae80 100755
--- a/lib/pure/times.nim
+++ b/lib/pure/times.nim
@@ -52,7 +52,7 @@ elif defined(windows):
 
 elif defined(ECMAScript):
   type
-    TTime* {.final.} = object
+    TTime* {.final, importc.} = object
       getDay: proc (): int
       getFullYear: proc (): int
       getHours: proc (): int
@@ -62,6 +62,7 @@ elif defined(ECMAScript):
       getSeconds: proc (): int
       getTime: proc (): int
       getTimezoneOffset: proc (): int
+      getDate: proc (): int
       getUTCDate: proc (): int
       getUTCFullYear: proc (): int
       getUTCHours: proc (): int
@@ -310,7 +311,8 @@ when not defined(ECMAScript):
       result = toFloat(int(clock())) / toFloat(clocksPerSec)
     
 else:
-  proc getTime(): TTime {.importc: "new Date", nodecl.}
+  proc newDate(): TTime {.importc: "new Date", nodecl.}
+  proc getTime(): TTime = return newDate()
 
   const
     weekDays: array [0..6, TWeekDay] = [
@@ -346,7 +348,7 @@ else:
     result.setDate(timeInfo.monthday)
   
   proc `$`(timeInfo: TTimeInfo): string = return $(TimeInfoToTIme(timeInfo))
-  proc `$`(time: TTime): string = $time.toLocaleString()
+  proc `$`(time: TTime): string = return $time.toLocaleString()
     
   proc `-` (a, b: TTime): int64 = 
     return a.getTime() - b.getTime()