25 #ifndef SRC_XRDZIP_XRDZIPUTILS_HH_
26 #define SRC_XRDZIP_XRDZIPUTILS_HH_
47 template<
typename UINT>
61 template<
typename INT>
64 const char *begin =
reinterpret_cast<const char*
>( &value );
65 const char *end = begin +
sizeof( INT );
67 std::reverse_copy( begin, end, std::back_inserter( buffer ) );
69 std::copy( begin, end, std::back_inserter( buffer ) );
77 template<
typename INT>
78 inline static void from_buffer( INT &var,
const char *&buffer )
80 memcpy( &var, buffer,
sizeof( INT ) );
84 buffer +=
sizeof( INT );
90 template<
typename INT>
91 inline static INT
to(
const char *buffer )
94 memcpy( &value, buffer,
sizeof( INT ) );
111 const std::time_t now = std::time(
nullptr );
112 const std::tm calendar_time = *std::localtime( std::addressof( now ) );
128 const std::tm calendar_time = *std::localtime( std::addressof( timestmp ) );
static INT to(const char *buffer)
static void from_buffer(INT &var, const char *&buffer)
std::vector< char > buffer_t
static void copy_bytes(const INT value, buffer_t &buffer)
static const uint8_t mon_shift
static const uint8_t hour_shift
static const uint8_t day_shift
static const uint16_t day_mask
static const uint16_t sec_mask
static const uint8_t min_shift
dos_timestmp(time_t timestmp)
static const uint16_t min_mask
static const uint16_t year_mask
static const uint16_t mon_mask
static const uint8_t year_shift
static const uint8_t sec_shift
static const uint16_t hour_mask