Open dcy opened 9 years ago
And another error:
Eshell V6.3 (abort with ^G)
1> qdate:start().
ok
2> calendar:local_time().
{{2015,11,19},{17,27,37}}
3> qdate:to_date(qdate:unixtime()).
{{2015,11,19},{9,28,1}}
it will be 8 hours difference.
Hi,
Thanks for the report.
That it crashes with "UTC+6" is definitely an error, and I will get that fixed.
Apparently it doesn't like "UTC+6", but "GMT+6" is fine, but does reveal a bug in erlang_localtime with respect to "GMT+-X" format in that it seems to increment and decrement the minutes rather than hours. That's another problem.
As for the calendar:local_time()
thing, that is not actually an error. Unless you've set a default timezone using the config key default_timezone
(or at runtime with application:set_env(qdate, default_timezone, XYZ)
), or set for the specific process using qdate:set_timezone(XYZ)
, then you will get that discrepancy.
qdate assumes GMT unless you've set one of the above settings to change the timezone. Conversely, calendar:local_time()
returns the current machine's timezone local time, while qdate:to_date() will convert any times to the currently set timezone (in the above example, GMT).
For now, I recommend using the canonical names for timezones, either the abbreviations (like "CST" for "Central Standard Time"), or the location names, like "Asia/Brunei".
The GMT+8 bug has been filed here: https://github.com/dmitryme/erlang_localtime/issues/26
will raise error:
qdate:to_date("UTC+8", util:unixtime()). will be "{error,unknown_tz}"
"GMT" works