certik / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

Implement support for timestamps #284

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I'm currently trying to incorporate the yaml-cpp in a Qt-based project.  One 
thing I need to serialise and deserialise is timestamps.  I haven't yet 
stumbled on a way to do this.  Specifically, I'm after a QDateTime, but I can 
tolerate a time_t or some generic date/time class.

The YAML way of giving these seems to be ISO8601 format, see example 2.2 here:
http://www.yaml.org/spec/1.2/spec.html#id2761292

I'm guessing the way forward is to implement custom serialisation methods.  If 
I come up with something I'll post back here.

Original issue reported on code.google.com by stua...@longlandclan.yi.org on 10 Mar 2015 at 2:40

GoogleCodeExporter commented 9 years ago
Okay, just figured out an example using the QDateTime type in Qt.  For a more 
generic version, you'd need to parse out the ISO8601 date yourself and come up 
with a C++ class to represent it or use time_t; QDateTime already has the logic 
for parsing ISO8601.

I think this is probably the only native YAML type that is missing in yaml-cpp, 
so if we could get some standard representation going, that'd make others' 
integration efforts a lot easier.

Original comment by stua...@longlandclan.yi.org on 10 Mar 2015 at 8:58

Attachments:

GoogleCodeExporter commented 9 years ago
I'm not convinced this is something that should go in the library proper, since 
it's not a native C++ data type. Maybe once I switch to C++11 this could be 
used with the new date types.

Original comment by jbe...@gmail.com on 10 Mar 2015 at 9:41

GoogleCodeExporter commented 9 years ago

Original comment by jbe...@gmail.com on 10 Mar 2015 at 9:41