diff options
author | Andrey Mekin <anmekin@gmail.com> | 2016-08-08 12:20:19 +0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-08 12:20:19 +0500 |
commit | 9f99cd2bf47eb22aaeb113bf2c91f761908f9d6f (patch) | |
tree | d6d4578d9da76111fcc001dc4118300175b5d852 /omaha_server/omaha/utils.py | |
parent | 76c90bbf0c41c6fab6e72068c80615aafd511e78 (diff) | |
parent | 3276929a0965df5baed680235ac9a73eed556fdd (diff) | |
download | omaha-server-9f99cd2bf47eb22aaeb113bf2c91f761908f9d6f.zip omaha-server-9f99cd2bf47eb22aaeb113bf2c91f761908f9d6f.tar.gz omaha-server-9f99cd2bf47eb22aaeb113bf2c91f761908f9d6f.tar.bz2 |
Merge pull request #199 from inebritov/feature/cup2
CUP 2
Diffstat (limited to 'omaha_server/omaha/utils.py')
-rw-r--r-- | omaha_server/omaha/utils.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/omaha_server/omaha/utils.py b/omaha_server/omaha/utils.py index 5be380d..bb164cf 100644 --- a/omaha_server/omaha/utils.py +++ b/omaha_server/omaha/utils.py @@ -47,6 +47,19 @@ def get_sec_since_midnight(date): return delta.seconds +def get_days_since_20070101(date): + """ + Return days since 2007-01-01 + + >>> from datetime import datetime + >>> get_days_since_20070101(datetime(year=2016, month=3, day=4)) + 3350 + """ + date_20070101 = datetime.datetime(year=2007, month=1, day=1, tzinfo=date.tzinfo) + delta = date - date_20070101 + return delta.days + + def get_id(uuid): """ >>> get_id('{8C65E04C-0383-4AE2-893F-4EC7C58F70DC}') |