Vlad Tamas
Vlad Tamas

Reputation: 33

C++ 98 time stamp to EPOCH

I have been looking for this but did not find nothing very useful. Can anyone help me, how can I convert a time stamp into epoch milliseconds only using c++ 98.

Upvotes: 1

Views: 869

Answers (1)

Nivedita Velagaleti
Nivedita Velagaleti

Reputation: 167

  • use the c library: ctime.h or time.h
  • create a tm structure with the values of date and time entered into the correct fields of the struct.
  • use mktime() or gmtime() functions to convert to epoch time in seconds. you can multiply by 1000 for milliseconds, but the accuracy will not be maintained.

Upvotes: 2

Related Questions