nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.53k stars 1.47k forks source link

`times` doesn't work in nimscript #24292

Open metagn opened 5 days ago

metagn commented 5 days ago

Description

This fails to compile on nimscript (at least on windows):

import times

Despite getTime being implemented for the VM, it's not usable in nimscript for this reason. CompileDate/CompileTime are alternatives though.

Most of the Time support is fine, the problem is timezones and by extension DateTime (and epochTime and cpuTime but they are not as important). We could either:

Not sure which is easier.

This was also reported in #12540 but closed, maybe it worked for a period, maybe it's just broken on windows. Mentioned in #24168.

Nim Version

2.2, as far back as 1.6.14 for me

Current Output

lib\windows\winlean.nim(844, 20) Error: VM does not support 'cast' from tyPointer to tyProc

Expected Output

No response

Known Workarounds

CompileDate/CompileTime

Additional Information

No response

juancarlospaco commented 3 days ago

This is (or was?) documented, I remember it adding it on Nimscript docs or related.