How does one parse an iso8601 string to eos time_point format?
1 Answer
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.
-
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
-
1If 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