1

How does one parse an iso8601 string to eos time_point format?

1 Answer 1

2

This example does not work:

void show(const std::string& time_str)
{
    const time_point& current_time = time_point::from_iso_string(time_str);
    print(current_time.elapsed._count);
}

time_point::from_iso_string was cut out from eos time_point. According to this issue one should not parse strings in smart contract at all. As instead, binary data should be used and passed to parameters for the sake of performance.

4
  • You should probably include this info as part of the question rather than an answer. Sep 25, 2018 at 19:14
  • This is answering my own question, as it states, that one should not do such thing per devs recommendation. Sep 25, 2018 at 19:57
  • 1
    I see I misread this. Sep 25, 2018 at 20:23
  • 1
    If you really really need to do this I suggest you copy-paste old from_iso_string implementation from the Git history and use it as a private method in your code. Sep 27, 2018 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.