RPC returns timestamp in two different formats

Started by monsterer, October 07, 2014, 06:20:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

vikram

#7
Should switch to the standard format in 0.4.25+: https://github.com/BitShares/bitshares_toolkit/issues/857

vikram

Quote from: monsterer on October 11, 2014, 10:33:54 AM
Quote from: xeroc on October 11, 2014, 08:22:14 AM
what vikram wanted to tell you is that the internal date format is the ISO standard ... only the GUI and the client do pretty printing ... the RPC interface will give you the ISO string ..

maybe this can help you: http://stackoverflow.com/questions/919244/converting-string-to-datetime-c-net

Which ISO standard is it using? It sure isn't this one: http://en.wikipedia.org/wiki/ISO_8601, because that has separators.

Looks like it is using the non-delimited form (which I guess is non-standard) shown here: http://www.boost.org/doc/libs/1_56_0/doc/html/date_time/posix_time.html#ptime_to_string

I assume this was done because Boost does not provide an opposite function to convert back from the delimited format--but it can be done: http://stackoverflow.com/a/21114783

I will verify if I can change the code to output the delimited format by default, but be able to read either format so as not to break people's existing wallet backups that use the old serialization.

In the meantime, maybe you can try reading the output using a custom format string: http://msdn.microsoft.com/en-us/library/8kb3ddd4%28v=vs.110%29.aspx

monsterer

Quote from: xeroc on October 11, 2014, 08:22:14 AM
what vikram wanted to tell you is that the internal date format is the ISO standard ... only the GUI and the client do pretty printing ... the RPC interface will give you the ISO string ..

maybe this can help you: http://stackoverflow.com/questions/919244/converting-string-to-datetime-c-net

Which ISO standard is it using? It sure isn't this one: http://en.wikipedia.org/wiki/ISO_8601, because that has separators.
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

xeroc

what vikram wanted to tell you is that the internal date format is the ISO standard ... only the GUI and the client do pretty printing ... the RPC interface will give you the ISO string ..

maybe this can help you: http://stackoverflow.com/questions/919244/converting-string-to-datetime-c-net

monsterer

Quote from: vikram on October 10, 2014, 08:32:31 PM
The difference is only in the pretty-printed output when using the command line interface. The pretty-printing is something that we add manually and thus is inconsistent across different commands. The actual raw RPC output uses the same ISO YYYYMMDDThhmmss format.

The trouble is YYYYMMDDThhmmss is not actually a valid timestamp format in c#. You need the separators in order for the language to be able to parse the string. Is there any chance of making this consistently pretty printed across all API responses?
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

vikram

The difference is only in the pretty-printed output when using the command line interface. The pretty-printing is something that we add manually and thus is inconsistent across different commands. The actual raw RPC output uses the same ISO YYYYMMDDThhmmss format.

monsterer

get_info returns YYYY-MM-DDThh:mm:ss

blockchain_get_asset returns YYYYMMDDThhmmss

Why the inconsistency?

Cheers, Paul.
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads