[cookies] simplify '_mac_absolute_time_to_posix()'

hardcode UNIX timestamp of 2001-01-01
pull/4031/head
Mike Fährmann 1 year ago
parent a14b63d941
commit 4c1f3b2160
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -20,7 +20,6 @@ import struct
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
from datetime import datetime, timedelta, timezone
from hashlib import pbkdf2_hmac from hashlib import pbkdf2_hmac
from http.cookiejar import Cookie from http.cookiejar import Cookie
from . import aes, text, util from . import aes, text, util
@ -921,8 +920,8 @@ def _get_linux_desktop_environment(env):
def _mac_absolute_time_to_posix(timestamp): def _mac_absolute_time_to_posix(timestamp):
return int((datetime(2001, 1, 1, 0, 0, tzinfo=timezone.utc) + # 978307200 is timestamp of 2001-01-01 00:00:00
timedelta(seconds=timestamp)).timestamp()) return 978307200 + int(timestamp)
def pbkdf2_sha1(password, salt, iterations, key_length): def pbkdf2_sha1(password, salt, iterations, key_length):

Loading…
Cancel
Save