Add fromWinTime and deprecate unixTimeToWinTime/winTimeToUnixTime (#7641)

This commit is contained in:
Oscar Nihlgård 2018-04-19 22:41:06 +02:00 • committed by Andreas Rumpf
commit 7d034d7b6a
3 changed files with 40 additions and 22 deletions

View file

@ -409,4 +409,11 @@ suite "ttimes":
# Bug with adding a day to a Time
let day = 24.hours
let tomorrow = now + day
check tomorrow - now == initDuration(days = 1)
check tomorrow - now == initDuration(days = 1)
test "fromWinTime/toWinTime":
check 0.fromUnix.toWinTime.fromWinTime.toUnix == 0
check (-1).fromWinTime.nanoseconds == convert(Seconds, Nanoseconds, 1) - 100
check -1.fromWinTime.toWinTime == -1
# One nanosecond is discarded due to differences in time resolution
check initTime(0, 101).toWinTime.fromWinTime.nanoseconds == 100