h5md-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h5md-user] HDF5 creation time tracking


From: Peter Colberg
Subject: Re: [h5md-user] HDF5 creation time tracking
Date: Wed, 29 May 2013 21:10:21 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, May 29, 2013 at 06:23:40PM -0400, Peter Colberg wrote:
> I did a short test of HDF5 object tracking times (using LuaJIT).
> 
> For groups, none of the times are set in the metadata:

Fortunately I am mistaken :-).

The issue was that object time tracking requires the HDF5 1.8 file
format. However, the HDF5 C or Fortran libraries write files in
the (long) deprecated HDF5 1.6 file format.

  local hdf5 = require("hdf5")
  do
    local fapl = hdf5.create_plist("file_access")
    fapl:set_libver_bounds("18", "latest")

    local file = hdf5.create_file("test.h5", "trunc", nil, fapl)

    local info = file:get_info()
    print("atime", info.atime)            -- atime   1369875814LL
    print("ctime", info.ctime)            -- ctime   1369875814LL
    print("mtime", info.mtime)            -- mtime   1369875814LL
    print("btime", info.btime)            -- btime   1369875814LL

    local group = file:create_group("trajectory")

    local info = group:get_info()
    print("atime", info.atime)            -- atime   1369875814LL
    print("ctime", info.ctime)            -- ctime   1369875814LL
    print("mtime", info.mtime)            -- mtime   1369875814LL
    print("btime", info.btime)            -- btime   1369875814LL
  end
  collectgarbage()
  do
    local file = hdf5.open_file("test.h5", "rdonly")

    local info = file:get_info()
    print("atime", info.atime)            -- atime   1369875814LL
    print("ctime", info.ctime)            -- ctime   1369875814LL
    print("mtime", info.mtime)            -- mtime   1369875814LL
    print("btime", info.btime)            -- btime   1369875814LL
  end
  collectgarbage()

Very nice. So we can drop the creation_time attribute indeed, and HDF5
handles all creation and modification time tracking out of the box.

Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]