1

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

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.

| improve this answer | |
  • You should probably include this info as part of the question rather than an answer. – Philip Kirkbride Sep 25 '18 at 19:14
  • This is answering my own question, as it states, that one should not do such thing per devs recommendation. – Lonkly Sep 25 '18 at 19:57
  • 1
    I see I misread this. – Philip Kirkbride Sep 25 '18 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. – Mikko Ohtamaa Sep 27 '18 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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