Requirement
I need to retrieve the date and time including milliseconds in C++11 on Windows. If possible, beginning earlier than 1970.
I also need to be able to extract year, month, day, hour, second and millisecond from the date/time variable.
What I've tried
time()
only returns seconds.clock()
doesn't return a date, only time since last system start. Good for measuring elapsed time, tho.Note: It only has to work with Windows. Linux is not required.
If you are using c++11, you should use chrono which allow you to manage time easier. It gives you a few methods to "cast" your time in whatever units you want (seconds to milliseconds, ...) and can manage ctime variables too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With