[cookies] simplify '_mac_absolute_time_to_posix()'
hardcode UNIX timestamp of 2001-01-01
This commit is contained in:
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user