Reputation: 1315
So I'm trying to find out if the current date on a Windows machine is after a hardcoded date. How would I go about doing this without using Boost or ATL? I'm using Visual Studio 2010 C++
Upvotes: 0
Views: 561
Reputation: 283624
You can use the OS-provided GetSystemTime
or GetLocalTime
functions, which return date components, or GetSystemTimeAsFileTime
, which returns the number of 100-nanosecond intervals that have elapsed since 12:00 A.M. January 1, 1601. No additional support libraries needed.
Upvotes: 1
Reputation:
The platform independent way to get the current date in C++ is time(NULL)
, which returns seconds since Jan 1, 1970. You can use other routines in ctime to either turn that into a string, pull out day/month/year/etc.
Upvotes: 1