123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #ifndef DATE_TIME_FILETIME_FUNCTIONS_HPP__
- #define DATE_TIME_FILETIME_FUNCTIONS_HPP__
- #include <boost/date_time/compiler_config.hpp>
- #if defined(BOOST_HAS_FTIME)
- #include <boost/cstdint.hpp>
- #include <boost/date_time/time.hpp>
- #include <boost/date_time/date_defs.hpp>
- namespace boost {
- namespace date_time {
- template< typename TimeT, typename FileTimeT >
- inline
- TimeT time_from_ftime(const FileTimeT& ft)
- {
- typedef typename TimeT::date_type date_type;
- typedef typename TimeT::date_duration_type date_duration_type;
- typedef typename TimeT::time_duration_type time_duration_type;
-
-
-
-
-
-
- uint64_t ft_as_integer = (static_cast< uint64_t >(ft.dwHighDateTime) << 32) | static_cast< uint64_t >(ft.dwLowDateTime);
- uint64_t sec = ft_as_integer / 10000000UL;
- uint32_t sub_sec = static_cast< uint32_t >(ft_as_integer % 10000000UL)
- #if !defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG)
- / 10U;
- #else
- * 100U;
- #endif
-
- const uint32_t sec_per_day = 86400;
- uint32_t days = static_cast< uint32_t >(sec / sec_per_day);
- uint32_t tmp = static_cast< uint32_t >(sec % sec_per_day);
- uint32_t hours = tmp / 3600;
- tmp %= 3600;
- uint32_t minutes = tmp / 60;
- tmp %= 60;
- uint32_t seconds = tmp;
- date_duration_type dd(days);
- date_type d = date_type(1601, Jan, 01) + dd;
- return TimeT(d, time_duration_type(hours, minutes, seconds, sub_sec));
- }
- }}
- #endif
- #endif
|