File: times.py

package info (click to toggle)
python-pymysql 0.9.3-2%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 816 kB
  • sloc: python: 6,029; makefile: 153; sh: 37
file content (20 lines) | stat: -rw-r--r-- 360 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from time import localtime
from datetime import date, datetime, time, timedelta


Date = date
Time = time
TimeDelta = timedelta
Timestamp = datetime


def DateFromTicks(ticks):
    return date(*localtime(ticks)[:3])


def TimeFromTicks(ticks):
    return time(*localtime(ticks)[3:6])


def TimestampFromTicks(ticks):
    return datetime(*localtime(ticks)[:6])