3D printing open source slice software Cura configuration step

2022-12-26   ES  

python, there are two modules that can complete the time operation:timedatetime

ComparisondatetimeMore powerful

below is the specific information of the two modules

>>> dir(time)
['__doc__', '__name__', '__package__', 'accept2dyear', 'altzone', 'asctime', 'clock', 'ctime', 'daylight', 'gmtime', 
'localtime', 'mktime', 'sleep', 'strftime', 'strptime', 'struct_time', 'time', 'timezone', 'tzname', 'tzset']
>>> dir(datetime.datetime)
['__add__', '__class__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', 
'__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__radd__', '__reduce__', '__reduce_ex__', '__repr__',
 '__rsub__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', 'astimezone', 'combine', 'ctime', 
'date', 'day', 'dst', 'fromordinal', 'fromtimestamp', 'hour', 'isocalendar', 'isoformat', 'isoweekday', 'max', 'microsecond',
 'min', 'minute', 'month', 'now', 'replace', 'resolution', 'second', 'strftime', 'strptime', 'time', 'timetuple', 'timetz', 'today', 
'toordinal', 'tzinfo', 'tzname', 'utcfromtimestamp', 'utcnow', 'utcoffset', 'utctimetuple', 'weekday', 'year']

If the time difference between the microsecond level is to be obtained, you can use the following code

import datetime
begin = datetime.datetime.now()
end = datetime.datetime.now()
k = end - begin

Look againkattributes and methods

>>> dir(k)
['__abs__', '__add__', '__class__', '__delattr__', '__div__', '__doc__', '__eq__', '__floordiv__', '__format__', '__ge__', 
'__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__mul__', '__ne__', '__neg__', '__new__', '__nonzero__',
 '__pos__', '__radd__', '__rdiv__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmul__', '__rsub__', '__setattr__',
 '__sizeof__', '__str__', '__sub__', '__subclasshook__', 'days', 'max', 'microseconds', 'min', 'resolution', 'seconds', 'total_seconds']

kdatetime.timedeltatype, the above istimedeltaAll attributes and functions
Use the following code to obtain the time difference between the unit in seconds, and the 6 digits after the decimal point are microseconds.

>>> k.total_seconds()


Related Posts

10.31 NOIP simulation race (Morning)

HDU2068 RPG has not been done yet! Intersection Intersection Combination

CSP-S 2019 preliminary knowledge point summary computer cultural basis

STM32F030CT86 timer 3 channel 1 to verify the PWM front and rear cut mode

3D printing open source slice software Cura configuration step

Random Posts

Business operation and maintenance actual combat: How does Tencent optimize the APP user experience?

LINUX system installation Oracle11G database through docker

linux terminal cannot display emoji problems

Android development environment address download Adt-Bundle Android-Studio SDK Adt

React’s eCharts realizes gradient and zoomed in Welkin