Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 281963 Details for
Bug 377565
dev-python/transmissionrpc (new package)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
files/fix-test.patch
fix-test.patch (text/plain), 1.78 KB, created by
Mike Gilbert
on 2011-08-03 15:11:42 UTC
(
hide
)
Description:
files/fix-test.patch
Filename:
MIME Type:
Creator:
Mike Gilbert
Created:
2011-08-03 15:11:42 UTC
Size:
1.78 KB
patch
obsolete
># 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 '-'
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 377565
:
281961
| 281963 |
281965