Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import time
- import datetime
- import math
- if __name__ == '__main__':
- print "Timestamp en secondes UTC depuis le 01/01/1970 0h00 UTC"
- hs = time.time()
- print hs
- print
- print "Verification en convertissant dans un format lisible"
- gm = time.gmtime(hs)
- print gm
- print
- print "Pesee du 09/04/2020 (19h 00m 50s)"
- sec = (datetime.datetime(2020, 4, 9, 17,00,50) - datetime.datetime(1970, 1, 1,0,0,0)).total_seconds()
- print sec
- print
- print "Timestamp InfluxDB correspondant, en string"
- tsinfluxdb = sec * 1000000000
- Stsinfluxdb = str((math.trunc(tsinfluxdb)))
- print(Stsinfluxdb)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement