Don't use datetime.strftime('%s')
This is dangerous for two major reasons: it may not be entirely
portable, and it doesn't do the thing you'd expect it to do.
If you, for instance, do:
datetime.datetime.utcnow().strftime('%s')
you do not get the Unix timestamp for the current UTC time; you
get the Unix timestamp for whatever the current UTC wall clock
time is *in the system's current time zone*. It doesn't even
work with explicitly timezone-aware datetime objects, because
the timezone information is lost somewhere between Python and
glibc's strftime. See:
https://bugs.python.org/issue12750
for more details on this. So, instead of doing that, we'll use
arrow's `timestamp` attribute instead. Python 3.3+ datetime
instances have a `timestamp()` method that works properly on
aware instances, but it's not available on Python 2.7 and you
still have to make sure you're using an aware instance. arrow
instances are always aware (they default to UTC timezone) and
`arrow.Arrow.timestamp` is available in Python 2 and 3.
This issue would have real consequences on any Pagure server
on a system whose timezone is *not* UTC - when getting JSON
representations of these things, the timestamps would not be
correct. For instance if an issue was created at 16:00 UTC,
the database would have 16:00, but on a system which is, say,
an hour behind UTC, when producing the JSON representation of
the issue, the timestamp would match 16:00 *local time* - so
it'd be the timestamp of 17:00 UTC.
Signed-off-by: Adam Williamson <awilliam@redhat.com>