Commit 979e3b3a authored by Alejandro Homs Puron's avatar Alejandro Homs Puron
Browse files

Merge branch...

Merge branch '123-hdf5-on-every-new-file-creation-add-nxroot-attributes-file_name-and-file_time' into 'master'

Resolve "[HDF5] On every new file creation add NXroot attributes file_name and file_time"

Closes #123

See merge request !172
parents ee039373 53dc0d7d
Pipeline #29550 passed with stages
in 34 minutes and 1 second
......@@ -348,7 +348,24 @@ void* SaveContainerHdf5::_open(const std::string &filename, std::ios_base::openm
write_h5_attribute(file->m_file, "NX_class", nxroot);
string nxcreator = "LIMA-"+ m_ct_parameters.lima_version;
write_h5_attribute(file->m_file, "creator", nxcreator);
// to know where the file comes from, add the filename (path) and creation date
string nxfilename = filename;
write_h5_attribute(file->m_file, "file_name", nxfilename);
// ISO 8601 Time format
time_t now;
char buf[sizeof("2011-10-08T07:07:09Z")];
#ifdef WIN32
struct tm gmtime_now;
gmtime_s(&gmtime_now, &now);
strftime(buf, sizeof(buf), "%FT%TZ", &gmtime_now);
strftime(buf, sizeof(buf), "%FT%TZ", gmtime(&now));
string stime = string(buf);
// could be the beamline/instrument name instead
Group instrument(file->m_entry.createGroup(m_ct_parameters.instrument_name));
string nxinstrument = "NXinstrument";
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment