Skip to content

Commit 46b93ce

Browse files
committed
BUG: time converter bug computing the hour
1 parent 54d7503 commit 46b93ce

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pandas/tseries/converter.py

+3
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,15 @@ def __call__(self, x, pos=0):
8686
us = int((x - s) * 1e6 - ms)
8787
m, s = divmod(s, 60)
8888
h, m = divmod(m, 60)
89+
_, h = divmod(h, 24)
8990
if us != 0:
9091
fmt += '.%6f'
9192
elif ms != 0:
9293
fmt += '.%3f'
94+
9395
return pydt.time(h, m, s, us).strftime(fmt)
9496

97+
9598
### Period Conversion
9699

97100

pandas/tseries/tests/test_converter.py

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class TestDateTimeConverter(unittest.TestCase):
1919

2020
def setUp(self):
2121
self.dtc = converter.DatetimeConverter()
22+
self.tc = converter.TimeFormatter(None)
2223

2324
def test_convert_accepts_unicode(self):
2425
r1 = self.dtc.convert("12:22",None,None)
@@ -42,6 +43,8 @@ def test_conversion(self):
4243
rs = self.dtc.convert('2012-1-1', None, None)
4344
self.assertEqual(rs, xp)
4445

46+
def test_time_formatter(self):
47+
self.tc(90000)
4548

4649

4750
if __name__ == '__main__':

0 commit comments

Comments
 (0)