This is an initial version of datetime class created by Asim. The code weren't tested under linux.
The patch file was created by inputing command:
svn diff > CDateTime.patch
under sandbox/cross_platform_test directory.
The code are neat. Here I have a few comments:
DateTime.h, line 18: #include <ostream>
line 27: std::ostream& operator<<(std::ostream& out, const DateTime& dt);
I suggest that we avoid including any STL headers in public headers. Those headers not only makes the compilation slower and slower but also increase object file sizes. Moreover, using stl library across dll boundaries is a nightmare.
If it is necessary to output CDateTime to iostream, I would suggest implementing this by providing the following two functions:
void ToString(OUT AsciiString& str) const;
void ToString(OUT UnicodeString& str) const;
The two functions are quite similar to System.Object.ToString() in C#.
I think the following functions are important for DateTime class:
- assignment operator (operator =)
- less operator (operator <)
- int Compare(const DateTime& rhs) const;
A c++ class that implements those functions can be easily used in STL containers. We can also use DateTime as a key in std::map without writing any new code.