fastrpc icon indicating copy to clipboard operation
fastrpc copied to clipboard

pool.DateTime(time_t, tz) and UTCTime(time_t) are wrong

Open volca02 opened this issue 4 years ago • 0 comments

The root cause is that the constructor of DateTime(time_t, timezone) will ignore the timezone altogether, so the component part of the time specification will be offset.

#include <iostream>

#include <frpcpool.h>
#include <frpcdatetime.h>

int main() {
    FRPC::Pool_t pool;

    auto &dt = pool.UTCTime(0);

    std::cout << dt.isoFormat() << std::endl;

    return 0;
}

outputs:

19700101T01:00:00+0000

which should be

19700101T00:00:00+0000

or

19700101T01:00:00+0100

volca02 avatar Apr 09 '20 08:04 volca02