Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongxianzhu committed Aug 20, 2018
1 parent 3861960 commit 7064ec7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion qingmi/model/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

from datetime import datetime
from ..base import db, cache
from qingmi.base import db, cache
from qingmi.utils import today


Expand Down
12 changes: 12 additions & 0 deletions qingmi/utils/time.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# coding: utf-8


def time2seconds(t):
""" 时间转秒数 """
h, m, s = t.strip().split(":")
return int(h) * 3600 + int(m) * 60 + int(s)


def seconds2time(sec):
""" 秒数转时间 """
m, s = divmod(sec, 60)
h, m = divmod(m, 60)
return "%02d:%02d:%02d" % (h, m, s)

0 comments on commit 7064ec7

Please sign in to comment.