rock-core / base-types

C/C++ and Ruby definition of the base types in Rock
6 stars 40 forks source link

test for Time::fromString does not pass #109

Open doudou opened 7 years ago

doudou commented 7 years ago

When running the tests for base::Time::fromString, I get the following error:

test.cpp(426): fatal error in "time_fromString": critical check formatNow.toMicroseconds() == 1339668306001001 failed [1339686306001001 != 1339668306001001]

It looks like a misplaced 8 (686 vs 668), but I really am not sure what the right value should be. Does it run for you @2maz ?

2maz commented 7 years ago

Test runs fine on Ubuntu 14.04 and the expected value should be correct (checked also with https://currentmillis.com/). What platform are you running the test on?

doudou commented 7 years ago

What platform are you running the test on?

16:04. I would guess it's a time zone issue (BRT vs CET)

2maz commented 7 years ago

Yap, that is probably it: looks like timezone handling is not fully implemented through strptime

https://www.gnu.org/software/libc/manual/html_node/Low_002dLevel-Time-String-Parsing.html


%Z

    The timezone name.

    Note: Currently, this is not fully implemented. The format is recognized, input is consumed but no field in tm is set.