#32 Time datatypes are non-portable

closed-fixed
None
5
2007-10-17
2005-07-08
No

A table generated in a big endian machine with a
column being a TimeCol type is not portable.

For example, the next script:

h5f = t.openFile('t.h5', 'w')
tbl = h5f.createTable(
'/', 'test',
{'t1': t.Time32Col(), 't2':
t.Time64Col(shape=(2,))})

row = tbl.row
for i in range(100):
row['t1'] = i
row['t2'] = (i - 1.0, i + 1.0)
row.append()
tbl.flush()

h5f.close()

when is run in a big-endian machine, generates a
file that, in a big-endian machine dumps like:

/ (RootGroup) ''
/test (Table(100L,)) ''
Data dump:
[0] (0, array([-1., 1.]))
[1] (1, array([ 0., 2.]))
[2] (2, array([ 1., 3.]))
[3] (3, array([ 2., 4.]))
[4] (4, array([ 3., 5.]))
...

while in a little endian machine dumps like:

/ (RootGroup) ''
/test (Table(100L,)) ''
Data dump:
[0] (0, array([ -1.00000000e-06,
1.67772160e+01]))
[1] (16777216, array([ 0. , 33.554432]))
[2] (33554432, array([ 16.777216, 50.331648]))
[3] (50331648, array([ 33.554432, 67.108864]))
[4] (67108864, array([ 50.331648, 83.88608 ]))
...

Discussion

  • Ivan Vilata i Balaguer

    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks