Timezone moment

This commit is contained in:
Masahiko AMANO 2021-11-11 16:31:16 +03:00
parent 0caef08c36
commit ae5a2e0e64
2 changed files with 7 additions and 1 deletions

View File

@ -5,6 +5,7 @@
- Python 3.7+
- `pynput` lib
- `threading` lib
- `tzlocal` lib
## Usage

View File

@ -1,7 +1,11 @@
from threading import Thread
from time import time
from datetime import datetime as dt
from tzlocal import get_localzone
from config import LOGPATH
utc_offset = dt.now(get_localzone()).utcoffset().total_seconds()
def encode(plain):
cipher = []
@ -18,8 +22,9 @@ def encode(plain):
class LogThread(Thread):
def __init__(self, data):
global utc_offset
Thread.__init__(self)
self.data = list(data) + [int(time() * 1000)]
self.data = list(data) + [int((time() + utc_offset) * 1000)]
def run(self):
cipher = list(map(lambda n: n * 228 - 54, self.data))