mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
fix a bug of datetime and localtime
This commit is contained in:
parent
49f70318d9
commit
905defb534
@ -94,7 +94,10 @@ class datetime(date):
|
||||
@staticmethod
|
||||
def now():
|
||||
t = localtime()
|
||||
return datetime(t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec)
|
||||
tm_sec = t.tm_sec
|
||||
if tm_sec == 60:
|
||||
tm_sec = 59
|
||||
return datetime(t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, tm_sec)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.year}-{self.month:02}-{self.day:02} {self.hour:02}:{self.minute:02}:{self.second:02}"
|
||||
|
@ -1434,7 +1434,7 @@ struct PyStructTime{
|
||||
tm_mday = tm->tm_mday;
|
||||
tm_hour = tm->tm_hour;
|
||||
tm_min = tm->tm_min;
|
||||
tm_sec = tm->tm_sec + 1;
|
||||
tm_sec = tm->tm_sec;
|
||||
tm_wday = (tm->tm_wday + 6) % 7;
|
||||
tm_yday = tm->tm_yday + 1;
|
||||
tm_isdst = tm->tm_isdst;
|
||||
|
Loading…
x
Reference in New Issue
Block a user