On Ubuntu 20.04.2 LTS, I use the 
[recent2](https://github.com/dotslash/recent2/blob/master/recent2.py) to log 
and query my bash history, which uses a sqlite3 database to store the history 
information. The `datetime` of running a command is inserted in the sqlite3 
database with [a `unixepoch` 
format](https://github.com/dotslash/recent2/blob/f1018aee228c710cc7d1b8b93bc0228791a54563/recent2.py#L45),
 and it will be converted into `localtime` accordingly when retrieved and 
displayed later.

But I found that it did not perform the correct conversion according to the 
time zone setting on the machine, as shown below:
```shell
werner@X10DAi-00:~$ rm 222222222222222222
rm: cannot remove '222222222222222222': No such file or directory
werner@X10DAi-00:~$ recent -fo -w . 2222222222222
rm 222222222222222222                              # rtime@ 2021-08-29 10:57:13
werner@X10DAi-00:~$ date 
Sun 29 Aug 2021 06:57:22 PM CST
```
I also filed an issue 
[here](https://discuss.python.org/t/python-sqlite3-datetime-verconsion-between-unixepoch-and-localtime/10382).
 Any hints for this problem?

Regards,
HY
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to