forked from certtools/intelmq
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request certtools#2506 from certtools/shadowserver-timezon…
…e-fix Timezone fix
- Loading branch information
Showing
2 changed files
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
SPDX-FileCopyrightText: 2020 Intelmq Team <[email protected]> | ||
SPDX-License-Identifier: AGPL-3.0-or-later | ||
""" | ||
from datetime import datetime, timedelta | ||
from datetime import datetime, timedelta, timezone | ||
import json | ||
import hashlib | ||
import hmac | ||
|
@@ -89,12 +89,11 @@ def _reports_list(self, date=None): | |
again. | ||
""" | ||
if date is None: | ||
date = datetime.today().date() | ||
daybefore = date - timedelta(2) | ||
dayafter = date + timedelta(1) | ||
date = datetime.now(timezone.utc).date() | ||
begin = date - timedelta(2) | ||
|
||
data = self.preamble | ||
data += f',"date": "{daybefore.isoformat()}:{dayafter.isoformat()}" ' | ||
data += f',"date": "{begin.isoformat()}:{date.isoformat()}" ' | ||
if len(self._report_list) > 0: | ||
data += f',"reports": {json.dumps(self._report_list)}' | ||
data += '}' | ||
|