I need to create a timestamp that follows the same notation as a regular timestamp except it's reference time starts from 01/01/2000 being time zero.
Asked
Active
Viewed 34 times
-1
-
And what difficulty are you having? What have you tried so far? – John Gordon Jun 07 '19 at 17:46
-
doesn`t seems to have difficult. Just use current time minus that time. There yo have it. See ros time implmentaion. they count from 1970 i think – Dr Yuan Shenghai Jun 07 '19 at 18:07
-
Tell us your current situation carolineodeluce – dpapadopoulos Jun 07 '19 at 18:22
1 Answers
0
I assume a "regular timestamp" should be seconds since?
import datetime
(datetime.datetime.now()-datetime.datetime(2000, 1, 1)).total_seconds()

paul
- 408
- 2
- 8
-
Yeah that works! How would I get nanoseconds with this as well? – carolineodeluce Jun 07 '19 at 18:15
-
The solution provides milliseconds precision. datetime does not support more than this, as do obviously most OS and hardware platforms AFAIK. See https://stackoverflow.com/a/10612166/1522205 – paul Jun 07 '19 at 20:05