now() returns same as current_zone()->to_local(now())

Hi,


system_clock::now() returns the same value as chr::current_zone()->to_local(now());
I expected now() to return UTC value and to->local(now()) to return CST value (GMT-6)...

1
2
3
4
namespace chr = std::chrono;      // shortcut for std::chrono
auto now_ = chr::system_clock::now();
// initialize today as current local date:
auto localNow = chr::current_zone()->to_local(now_);


???


Also, auto tp{ chr::local_days{d} + 18h + 30min } returns the same as auto tp{ chr::sys_days{d} + 18h + 30min };

Last edited on
A quick search reveals:

https://en.cppreference.com/w/cpp/chrono/utc_clock

There are others such as gps time; atomic time etc.

https://en.cppreference.com/w/cpp/chrono

https://en.cppreference.com/w/cpp/chrono/clock_time_conversion

It's all in the manual ....
Topic archived. No new replies allowed.