EOSIO / EOSIO/fc

convert time_point_sec to string should explicit the zone info

Open
#34 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
39
Forks
93
PR merge metrics
No merged PRs in 30d

Description

time_point_sec::to_iso_string use boost::ptime to convert time_t to ios 8601 time string format with:
const auto ptime = boost::posix_time::from_time_t( time_t( sec_since_epoch() ) );
return boost::posix_time::to_iso_extended_string( ptime );
Note ptime has drop the zone info, and not strict compatible iso 8610.
it convert to string without zone and can be understand in context,
(sometimes is UTC or sometimes local zone with utc_to_local...)

https://en.wikipedia.org/wiki/ISO_8601, it says
"If no UTC relation information is given with a time representation, the time is assumed to be in local time. ...", it confused, i thank should append 'Z' to indicate UTC zone, and change code:
return boost::posix_time::to_iso_extended_string( ptime )+"Z";

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.