mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-05-20 17:45:45 -05:00
cleaner formula
Co-authored-by: pukkandan <pukkandan.ytdlp@gmail.com>
This commit is contained in:
parent
5b6ad82dae
commit
58f7f5479b
1 changed files with 1 additions and 1 deletions
|
@ -1390,7 +1390,7 @@ def datetime_round(dt_, precision='day'):
|
||||||
'second': 1,
|
'second': 1,
|
||||||
}
|
}
|
||||||
roundto = lambda x, n: ((x + n / 2) // n) * n
|
roundto = lambda x, n: ((x + n / 2) // n) * n
|
||||||
timestamp = roundto(calendar.timegm(dt_.timetuple()) * time_scale + dt_.microsecond, unit_seconds[precision] * time_scale) / time_scale
|
timestamp = roundto(calendar.timegm(dt_.timetuple()) + dt_.microsecond / time_scale, unit_seconds[precision])
|
||||||
return datetime_from_timestamp(timestamp)
|
return datetime_from_timestamp(timestamp)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue