* [gentoo-commits] gentoo-x86 commit in dev-python/transmissionrpc/files: transmissionrpc-timestamp-test.patch
@ 2011-08-29 0:37 Mike Gilbert (floppym)
0 siblings, 0 replies; 2+ messages in thread
From: Mike Gilbert (floppym) @ 2011-08-29 0:37 UTC (permalink / raw
To: gentoo-commits
floppym 11/08/29 00:37:47
Added: transmissionrpc-timestamp-test.patch
Log:
New package for bug 377565
(Portage version: 2.2.0_alpha51/cvs/Linux x86_64)
Revision Changes Path
1.1 dev-python/transmissionrpc/files/transmissionrpc-timestamp-test.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/transmissionrpc/files/transmissionrpc-timestamp-test.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/transmissionrpc/files/transmissionrpc-timestamp-test.patch?rev=1.1&content-type=text/plain
Index: transmissionrpc-timestamp-test.patch
===================================================================
# HG changeset patch
# User Mike Gilbert <floppymaster@gmail.com>
# Date 1312249052 14400
# Node ID 144110dc47fae14f2692afa1be1e57d461b7393e
# Parent 4fe71eb818d0a220b8fe6370fa00c997e7f12e4b
Use UTC for utils.format_timestamp unit test.
This removes dependence on the local time zone when running tests.
diff --git a/test/utils.py b/test/utils.py
--- a/test/utils.py
+++ b/test/utils.py
@@ -55,11 +55,11 @@
def testFormatTimestamp(self):
table = {
0: '-',
- 1: '1970-01-01 01:00:01',
- 1129135532: '2005-10-12 18:45:32',
+ 1: '1970-01-01 00:00:01',
+ 1129135532: '2005-10-12 16:45:32',
}
for timestamp, expected in table.iteritems():
- self.assertEqual(tu.format_timestamp(timestamp), expected)
+ self.assertEqual(tu.format_timestamp(timestamp, utc=True), expected)
def testInetAddress(self):
table = {
@@ -97,4 +97,4 @@
return suite
if __name__ == '__main__':
- unittest.main()
\ No newline at end of file
+ unittest.main()
diff --git a/transmissionrpc/utils.py b/transmissionrpc/utils.py
--- a/transmissionrpc/utils.py
+++ b/transmissionrpc/utils.py
@@ -34,12 +34,15 @@
hours, minutes = divmod(minutes, 60)
return '%d %02d:%02d:%02d' % (delta.days, hours, minutes, seconds)
-def format_timestamp(timestamp):
+def format_timestamp(timestamp, utc=False):
"""
Format unix timestamp into ISO date format.
"""
if timestamp > 0:
- dt_timestamp = datetime.datetime.fromtimestamp(timestamp)
+ if utc:
+ dt_timestamp = datetime.datetime.utcfromtimestamp(timestamp)
+ else:
+ dt_timestamp = datetime.datetime.fromtimestamp(timestamp)
return dt_timestamp.isoformat(' ')
else:
return '-'
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gentoo-commits] gentoo-x86 commit in dev-python/transmissionrpc/files: transmissionrpc-timestamp-test.patch
@ 2013-04-17 17:07 Mike Gilbert (floppym)
0 siblings, 0 replies; 2+ messages in thread
From: Mike Gilbert (floppym) @ 2013-04-17 17:07 UTC (permalink / raw
To: gentoo-commits
floppym 13/04/17 17:07:30
Removed: transmissionrpc-timestamp-test.patch
Log:
Version bump with python3 support.
(Portage version: 2.2.0_alpha173/cvs/Linux x86_64, signed Manifest commit with key 0BBEEA1FEA4843A4)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-17 17:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-17 17:07 [gentoo-commits] gentoo-x86 commit in dev-python/transmissionrpc/files: transmissionrpc-timestamp-test.patch Mike Gilbert (floppym)
-- strict thread matches above, loose matches on Subject: below --
2011-08-29 0:37 Mike Gilbert (floppym)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox