i'm fiddling around python's datetime.datetime.utcnow() function in both python 2.7.6 , 3.4.3 , noticed interesting: microsecond value in python27 000.
i'm on windows 7 professional (64bit) machine. python27 install 32bit, , python34 install 64bit.
in python 2, microseconds 000:
python 2.7.6 (default, nov 10 2013, 19:24:18) [msc v.1500 32 bit (intel)] on win32 type "help", "copyright", "credits" or "license" more information. >>> import datetime >>> datetime.datetime.utcnow() datetime.datetime(2015, 7, 20, 23, 7, 27, 55000) >>> datetime.datetime.utcnow() datetime.datetime(2015, 7, 20, 23, 7, 27, 991000) >>> datetime.datetime.utcnow() datetime.datetime(2015, 7, 20, 23, 7, 28, 279000) >>> datetime.datetime.utcnow() datetime.datetime(2015, 7, 20, 23, 7, 29, 7000) in python 3, microsecond value more reasonable:
python 3.4.3 (v3.4.3:9b73f1c3e601, feb 24 2015, 22:44:40) [msc v.1600 64 bit (amd64)] on win32 type "help", "copyright", "credits" or "license" more information. >>> import datetime >>> datetime.datetime.utcnow() datetime.datetime(2015, 7, 20, 23, 8, 32, 97893) >>> datetime.datetime.utcnow() datetime.datetime(2015, 7, 20, 23, 8, 32, 665950) >>> datetime.datetime.utcnow() datetime.datetime(2015, 7, 20, 23, 8, 33, 322016) could provide me info on changed between 2 , 3 or why happening? haven't been able find in docs, , have no idea start looking in python source.
in addition, how can microsecond datetime accuracy in python2? i'm hesitant use time.time() because of warning in docs regarding system clock being rolled back. since i'm interested in deltas, should able use time.clock(), correct?
Comments
Post a Comment