BitShares Forum

Main => Technical Support => Topic started by: monsterer on October 07, 2014, 06:20:08 pm

Title: RPC returns timestamp in two different formats
Post by: monsterer 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.
Title: Re: RPC returns timestamp in two different formats
Post by: 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.
Title: Re: RPC returns timestamp in two different formats
Post by: monsterer 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?
Title: Re: RPC returns timestamp in two different formats
Post by: 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
Title: Re: RPC returns timestamp in two different formats
Post by: monsterer 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.
Title: Re: RPC returns timestamp in two different formats
Post by: vikram 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
Title: Re: RPC returns timestamp in two different formats
Post by: vikram 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