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.54k stars 1.47k forks source link

Improvements to times.nim #5004

Closed flyx closed 7 years ago

flyx commented 7 years ago

This is an issue for me which lists things I want to improve in the times module after #4984 has been merged.

qqtop commented 7 years ago

getTimeZone and getTzname is in the docs but not exported after the recent merge.

flyx commented 7 years ago

@qqtop: Yes, because the online documentation is for the recent release 0.15.2, where those procs still exist. Since it is automatically generated, those procs will vanish when the docs are regenerated for the next release.

ghost commented 7 years ago

Microseconds would nice too

flyx commented 7 years ago

@baabelfish: I think times is the wrong module if you want microsecond precision. The problem is that all calculation converts TimeInfo to Time which is by definition in seconds. So you will basically lose your microseconds as soon as you do anything with it.

qqtop commented 7 years ago

Hope you can fix this too , as it messes up my schedule for March 2100


import times

echo getDaysInMonth(mFeb,2100)         # 28
echo getDayOfWeekJulian(28, 2, 2100)   # Sunday
echo getDayOfWeekJulian(1, 3, 2100)    # Tuesday  ???
flyx commented 7 years ago

@qqtop: That's not an error. The Julian calendar does not include the rule that 00 years are only leap years if they are divisible by 400 (this was the change the Gregorian calendar introduced). So in the Julian calendar, February 2100 has 29 days and therefore, 28.2.2100 and 1.3.2100 are two days apart.