diff options
author | 2016-06-26 07:54:27 -0400 | |
---|---|---|
committer | 2016-06-26 08:12:07 -0400 | |
commit | 5009b55430ba99295c0d7a31b336c61795f6cec3 (patch) | |
tree | e1e22ab3e5ee9661e40a1549bd0030e07edb8232 /src/lib/util/timeconv.h | |
parent | 3232bfad8909240fe18a63fe1c5090efe09bf626 (diff) |
Introduced src/lib/util/timeconv.[c|h], moved code from un7z.cpp into it, and implemented win_time_point_from_filetime() in terms of it
Diffstat (limited to 'src/lib/util/timeconv.h')
-rw-r--r-- | src/lib/util/timeconv.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/lib/util/timeconv.h b/src/lib/util/timeconv.h new file mode 100644 index 00000000000..7f6e5085fd4 --- /dev/null +++ b/src/lib/util/timeconv.h @@ -0,0 +1,54 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb, Nathan Woods +/*************************************************************************** + + timeconv.h + + Time conversion utility code + +***************************************************************************/ + +#pragma once + +#ifndef MAME_LIB_UTIL_TIMECONV_H +#define MAME_LIB_UTIL_TIMECONV_H + +#include "osdcore.h" + +#include <chrono> + + +namespace util { + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +typedef std::chrono::duration<std::uint64_t, std::ratio<1, 10000000> > ntfs_duration; + + +/*************************************************************************** + INLINE FUNCTIONS +***************************************************************************/ + +// ------------------------------------------------- +// ntfs_duration_from_filetime +// ------------------------------------------------- + +inline ntfs_duration ntfs_duration_from_filetime(std::uint32_t high, std::uint32_t low) +{ + return ntfs_duration((std::uint64_t(high) << 32) | std::uint64_t(low)); +} + + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +ntfs_duration ntfs_duration_from_filetime(std::uint32_t high, std::uint32_t low); +std::chrono::system_clock::time_point system_clock_time_point_from_ntfs_duration(ntfs_duration d); + + +} // namespace util + +#endif // MAME_LIB_UTIL_TIMECONV_H |