DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
#ifndef DATE_TIME_TIME_SYSTEM_SPLIT_HPP #define DATE_TIME_TIME_SYSTEM_SPLIT_HPP /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ */ #include
#include "boost/date_time/compiler_config.hpp" #include "boost/date_time/special_defs.hpp" namespace boost { namespace date_time { //! An unadjusted time system implementation. #if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) template
#else template
#endif class split_timedate_system { public: typedef typename config::time_rep_type time_rep_type; typedef typename config::date_type date_type; typedef typename config::time_duration_type time_duration_type; typedef typename config::date_duration_type date_duration_type; typedef typename config::int_type int_type; typedef typename config::resolution_traits resolution_traits; //86400 is number of seconds in a day... #if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) typedef date_time::wrapping_int
wrap_int_type; #else private: BOOST_STATIC_CONSTANT(int_type, ticks_per_day = INT64_C(86400) * config::tick_per_second); public: # if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0X581) ) typedef date_time::wrapping_int< split_timedate_system::int_type, split_timedate_system::ticks_per_day> wrap_int_type; # else typedef date_time::wrapping_int
wrap_int_type; #endif #endif static time_rep_type get_time_rep(special_values sv) { switch (sv) { case not_a_date_time: return time_rep_type(date_type(not_a_date_time), time_duration_type(not_a_date_time)); case pos_infin: return time_rep_type(date_type(pos_infin), time_duration_type(pos_infin)); case neg_infin: return time_rep_type(date_type(neg_infin), time_duration_type(neg_infin)); case max_date_time: { time_duration_type td = time_duration_type(24,0,0,0) - time_duration_type(0,0,0,1); return time_rep_type(date_type(max_date_time), td); } case min_date_time: return time_rep_type(date_type(min_date_time), time_duration_type(0,0,0,0)); default: return time_rep_type(date_type(not_a_date_time), time_duration_type(not_a_date_time)); } } static time_rep_type get_time_rep(const date_type& day, const time_duration_type& tod, date_time::dst_flags dst=not_dst) { if(day.is_special() || tod.is_special()) { if(day.is_not_a_date() || tod.is_not_a_date_time()) { return time_rep_type(date_type(not_a_date_time), time_duration_type(not_a_date_time)); } else if(day.is_pos_infinity()) { if(tod.is_neg_infinity()) { return time_rep_type(date_type(not_a_date_time), time_duration_type(not_a_date_time)); } else { return time_rep_type(day, time_duration_type(pos_infin)); } } else if(day.is_neg_infinity()) { if(tod.is_pos_infinity()) { return time_rep_type(date_type(not_a_date_time), time_duration_type(not_a_date_time)); } else { return time_rep_type(day, time_duration_type(neg_infin)); } } else if(tod.is_pos_infinity()) { if(day.is_neg_infinity()) { return time_rep_type(date_type(not_a_date_time), time_duration_type(not_a_date_time)); } else { return time_rep_type(date_type(pos_infin), tod); } } else if(tod.is_neg_infinity()) { if(day.is_pos_infinity()) { return time_rep_type(date_type(not_a_date_time), time_duration_type(not_a_date_time)); } else { return time_rep_type(date_type(neg_infin), tod); } } } return time_rep_type(day, tod); } static date_type get_date(const time_rep_type& val) { return date_type(val.day); } static time_duration_type get_time_of_day(const time_rep_type& val) { return time_duration_type(val.time_of_day); } static std::string zone_name(const time_rep_type&) { return ""; } static bool is_equal(const time_rep_type& lhs, const time_rep_type& rhs) { return ((lhs.day == rhs.day) && (lhs.time_of_day == rhs.time_of_day)); } static bool is_less(const time_rep_type& lhs, const time_rep_type& rhs) { if (lhs.day < rhs.day) return true; if (lhs.day > rhs.day) return false; return (lhs.time_of_day < rhs.time_of_day); } static time_rep_type add_days(const time_rep_type& base, const date_duration_type& dd) { return time_rep_type(base.day+dd, base.time_of_day); } static time_rep_type subtract_days(const time_rep_type& base, const date_duration_type& dd) { return split_timedate_system::get_time_rep(base.day-dd, base.time_of_day); } static time_rep_type subtract_time_duration(const time_rep_type& base, const time_duration_type& td) { if(base.day.is_special() || td.is_special()) { return split_timedate_system::get_time_rep(base.day, -td); } if (td.is_negative()) { time_duration_type td1 = td.invert_sign(); return add_time_duration(base,td1); } //std::cout << td.ticks() << std::endl; wrap_int_type day_offset(base.time_of_day.ticks()); date_duration_type day_overflow(static_cast
(day_offset.subtract(td.ticks()))); // std::cout << "sub: " << base.time_of_day.ticks() << "|" // << day_offset.as_int() << "|" // << day_overflow.days() << std::endl; return time_rep_type(base.day-day_overflow, time_duration_type(0,0,0,day_offset.as_int())); } static time_rep_type add_time_duration(const time_rep_type& base, time_duration_type td) { if(base.day.is_special() || td.is_special()) { return split_timedate_system::get_time_rep(base.day, td); } if (td.is_negative()) { time_duration_type td1 = td.invert_sign(); return subtract_time_duration(base,td1); } wrap_int_type day_offset(base.time_of_day.ticks()); typename date_duration_type::duration_rep_type doff = day_offset.add(td.ticks()); // std::cout << "day overflow: " << doff << std::endl; // std::cout << "ticks: " << td.ticks() << std::endl; date_duration_type day_overflow(doff); // std::cout << "base: " << to_simple_string(base.day) << std::endl; // std::cout << "overflow " << day_overflow.days() << std::endl; return time_rep_type(base.day+day_overflow, time_duration_type(0,0,0,day_offset.as_int())); } static time_duration_type subtract_times(const time_rep_type& lhs, const time_rep_type& rhs) { date_duration_type dd = lhs.day - rhs.day; time_duration_type td(dd.days()*24,0,0); //days * 24 hours time_duration_type td2 = lhs.time_of_day - rhs.time_of_day; return td+td2; // return time_rep_type(base.day-dd, base.time_of_day); } }; } } //namespace date_time #endif
time_system_split.hpp
Page URL
File URL
Prev
55/60
Next
Download
( 8 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.