I have a class that needs to contain a time variable. How to do that? I would like to specify that I communicate with a server and as a response at time section I receive for example: 2011-07-01T14:32:39+02:00 .APPRECIATE. THX
P.S I would like to use the C++ API.
There are several solutions each with another drawback. One would be to just calculate the timestamp and save it as a number. Another would be to use boost date_time (which I would prefer if you can introduce a dependency to boost).
It all very much depends on what you need to do with the time. If you only need to save it and don’t need to do calculations on it, may be even a std::string would be good enough. If you need to do very simple operations on it, a timestamp is probably good enough and the simplest way (however you still have the burden to parse it). For complex stuff boost would be my preferred way to go.