milliseconds since 1970

I just needed to get the local time (computer clock / not utc in my case) milliseconds since 1970 (epoch). this is kind of trickier then I had thought at first, since time() (as I understand it) gets non localtime seconds since 1970. Anyway, some poking around poco got me to this, which seemed to work:

  
  
Poco::Timestamp epoch(0);  
Poco::Timestamp now;  
Poco::Timestamp::TimeDiff diffTime = (now - epoch);  
long long millisSince1970 = (long long) (diffTime/1000);  
  

timestamp seems pretty cool, and the date times stuff was fairly flexible. +1 for poco :wink:

Nice to know.
I did somthing similar with the c library, just for de localtime.

  
time_t rawtime;  
    struct tm * timeinfo;  
    time ( &rawtime );  
    timeinfo = localtime ( &rawtime );  

For more references :
http://www.cplusplus.com/reference/clib-…-localtime/

cool !

but I guess that’s getting you seconds since 1970?

I was interested in getting the milliseconds (since I’m doing things where that matters…)

take care!
zach