0

I have

int year=2010;
int month=0; //starts from 0
int day=0;   //starts from 0
int hour=0;  //24 hours
int minute = 1 
int second= 20;
int millisec=90;

How can I convert them into uint64_t which contains milliseconds since Midnight Jan1 1970 (UTC time)? Similar to UNIX time shown here

So the 7 ints in the above example would become: 1573603280090

uint64_t millisec = someFunction(); //<--which func to use?

this post discusses how to retrieve the time from chrono::time_point, so it doesn't help me

this post asks how to convert string into utc time, but I have integers and wish to use them directly.

Using C++17

Kari
  • 1,244
  • 1
  • 13
  • 27
  • 2
    May want to refer to the `tm` structure in `time.h` : https://pubs.opengroup.org/onlinepubs/007908799/xsh/time.h.html – Eljay Nov 13 '19 at 00:18
  • Possible duplicate of [How to convert a time into epoch time?](https://stackoverflow.com/questions/11979655/how-to-convert-a-time-into-epoch-time) – JaMiT Nov 13 '19 at 01:57
  • Assuming your input is UTC/Unix Time: https://stackoverflow.com/a/32158604/576911 – Howard Hinnant Nov 13 '19 at 08:29

0 Answers0