Posts: 455
Threads: 16
Joined: Jun 2022
Nov-16-2022, 10:22 AM
(This post was last modified: Nov-16-2022, 10:28 AM by rob101.)
I put this together, for my own reference, but if it's of help, then you're welcome to it.
import time
hr = '{}{}{}'.format('\n'*2,'-'*50,'\n') #horizontal rule
print('''time.gmtime(0): returns system’s epoch setting:
The starting point against which you can measure the
passage of time.
''')
system_epoch = time.gmtime()
print(system_epoch,hr)
print('''time.time() returns the number of seconds
that have passed since the epoch; return value is a
floating point number to account for fractional seconds:
''')
tt = time.time()
print(tt,hr)
print('''time.ctime() will return a string object
representation of the time and date based on the
number of seconds since epoch, or the current time
and date, if nothing is passed to the function.
The string representation of time, also known as a
timestamp, returned by ctime() is formatted with the
following structure:
1: Day of the week
2: Month of the year
3: Day of the month
4: Hours, minutes, and seconds using the 24-hour
clock notation
5: Year
''')
tc = time.ctime(1660867200)
print('''Note: time.ctime(0) may not return the same timestamp
on every computer system
''')
print('''For details about time zones, see:
https://realpython.com/python-time-module/
''')
print(tc,hr)
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein