[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: os.time() and the last second of 1969
- From: Marc Balmer <marc@...>
- Date: Sat, 12 Feb 2022 13:54:37 +0100
mktime() is a function to calculate the number of seconds *since* the epoch. Note the *since*.
Since mktime() returns -1 to signal an error and the last second of 1969 (which is -1 seconds from the epoch) returns the same value that is otherwise used to signal an error, the program misinterprets the result.
In consequence, when mktime() returns -1, you probably should take a look at errno (in C code), as mktime() sets errno accordingly.