diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-09-22 11:38:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-22 11:38:30 +0800 |
commit | c0838826c0071e9bf9a456a82b237b63f21f2b12 (patch) | |
tree | a8c9f8c67407ce1cf51cf8dc15a81bd87c62da6f /lib | |
parent | a1b6fa9420db09f2660ad5919d2b96673f324f8f (diff) | |
download | Nim-c0838826c0071e9bf9a456a82b237b63f21f2b12.tar.gz |
fixes #22519; DocGen does not work for std/times on JS backend (#22738)
fixes #22519
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/times.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 9c32c7b21..05a123055 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -2787,7 +2787,9 @@ proc epochTime*(): float {.tags: [TimeEffect].} = ## ## .. warning:: Unsuitable for benchmarking (but still better than `now`), ## use `monotimes.getMonoTime` or `cpuTime` instead, depending on the use case. - when defined(macosx): + when defined(js): + result = newDate().getTime() / 1000 + elif defined(macosx): var a {.noinit.}: Timeval gettimeofday(a) result = toBiggestFloat(a.tv_sec.int64) + toBiggestFloat( @@ -2804,8 +2806,6 @@ proc epochTime*(): float {.tags: [TimeEffect].} = var secs = i64 div rateDiff var subsecs = i64 mod rateDiff result = toFloat(int(secs)) + toFloat(int(subsecs)) * 0.0000001 - elif defined(js): - result = newDate().getTime() / 1000 else: {.error: "unknown OS".} |