The SYSTEMTIME structure and the GetSystemTime () function are functions of the Windows API and are not part of the main language or standard library. I know this is a little picky, but it can save some embarrassment later if someone who is not on Windows reads this.
I would prefer the recommendation for the Boost :: DateTime library that Chris made. As an aside, if you want to write standard C ++, you really only have the old C date and time functions, which are also in ctime . But if you really weren't stuck in a store where for some reason you can't use boost, I would go with Boost :: DateTime.
source share