Author Topic: RPC returns timestamp in two different formats  (Read 1843 times)

0 Members and 1 Guest are viewing this topic.

Offline vikram

« Last Edit: October 29, 2014, 07:11:58 pm by vikram »

Offline vikram

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

Offline monsterer

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.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: 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

Offline monsterer

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.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline 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.

Offline 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.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads