Author [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: RPC returns timestamp in two different formats  (Read 344 times)

0 Members and 1 Guest are viewing this topic.

Offline monsterer

RPC returns timestamp in two different formats
« on: October 07, 2014, 06:20:08 PM »

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

Offline vikram

Re: RPC returns timestamp in two different formats
« Reply #1 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.

Offline monsterer

Re: RPC returns timestamp in two different formats
« Reply #2 on: October 10, 2014, 10:26:44 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.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12336
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: RPC returns timestamp in two different formats
« Reply #3 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
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline monsterer

Re: RPC returns timestamp in two different formats
« Reply #4 on: October 11, 2014, 10:33:54 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.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline vikram

Re: RPC returns timestamp in two different formats
« Reply #5 on: October 16, 2014, 06:31:50 PM »
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 vikram

Re: RPC returns timestamp in two different formats
« Reply #6 on: October 28, 2014, 11:05:20 PM »
Should switch to the standard format in 0.4.25+: https://github.com/BitShares/bitshares_toolkit/issues/857
« Last Edit: October 29, 2014, 07:11:58 PM by vikram »

 

Google+