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 LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__ #define LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__ /* Copyright (c) 2003-2005 CrystalClear Software, Inc. * 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 "boost/date_time/time_zone_base.hpp" #include "boost/date_time/time_zone_names.hpp" #include "boost/date_time/posix_time/posix_time.hpp" #include "boost/date_time/local_time/dst_transition_day_rules.hpp" #include "boost/date_time/string_convert.hpp" //#include "boost/date_time/special_defs.hpp" #include "boost/shared_ptr.hpp" namespace boost { namespace local_time { //typedef boost::date_time::time_zone_names time_zone_names; typedef boost::date_time::dst_adjustment_offsets
dst_adjustment_offsets; //typedef boost::date_time::time_zone_base
time_zone; typedef boost::shared_ptr
dst_calc_rule_ptr; //! A real time zone template
class custom_time_zone_base : public date_time::time_zone_base
{ public: typedef boost::posix_time::time_duration time_duration_type; typedef date_time::time_zone_base
base_type; typedef typename base_type::string_type string_type; typedef typename base_type::stringstream_type stringstream_type; typedef date_time::time_zone_names_base
time_zone_names; typedef CharT char_type; custom_time_zone_base(const time_zone_names& zone_names, const time_duration_type& utc_offset, const dst_adjustment_offsets& dst_shift, boost::shared_ptr
calc_rule) : zone_names_(zone_names), base_utc_offset_(utc_offset), dst_offsets_(dst_shift), dst_calc_rules_(calc_rule) {}; virtual ~custom_time_zone_base() {}; virtual string_type dst_zone_abbrev() const { return zone_names_.dst_zone_abbrev(); } virtual string_type std_zone_abbrev() const { return zone_names_.std_zone_abbrev(); } virtual string_type dst_zone_name() const { return zone_names_.dst_zone_name(); } virtual string_type std_zone_name() const { return zone_names_.std_zone_name(); } //! True if zone uses daylight savings adjustments virtual bool has_dst() const { return (dst_calc_rules_); //if calc_rule is set the tz has dst } //! Local time that DST starts -- NADT if has_dst is false virtual posix_time::ptime dst_local_start_time(gregorian::greg_year y) const { gregorian::date d(gregorian::not_a_date_time); if (dst_calc_rules_) { d = dst_calc_rules_->start_day(y); } return posix_time::ptime(d, dst_offsets_.dst_start_offset_); } //! Local time that DST ends -- NADT if has_dst is false virtual posix_time::ptime dst_local_end_time(gregorian::greg_year y) const { gregorian::date d(gregorian::not_a_date_time); if (dst_calc_rules_) { d = dst_calc_rules_->end_day(y); } return posix_time::ptime(d, dst_offsets_.dst_end_offset_); } //! Base offset from UTC for zone (eg: -07:30:00) virtual time_duration_type base_utc_offset() const { return base_utc_offset_; } //! Adjustment forward or back made while DST is in effect virtual time_duration_type dst_offset() const { return dst_offsets_.dst_adjust_; } //! Returns a POSIX time_zone string for this object virtual string_type to_posix_string() const { // std offset dst [offset],start[/time],end[/time] - w/o spaces stringstream_type ss; ss.fill('0'); boost::shared_ptr
no_rules; // std ss << std_zone_abbrev(); // offset if(base_utc_offset().is_negative()) { // inverting the sign guarantees we get two digits ss << '-' << std::setw(2) << base_utc_offset().invert_sign().hours(); } else { ss << '+' << std::setw(2) << base_utc_offset().hours(); } if(base_utc_offset().minutes() != 0 || base_utc_offset().seconds() != 0) { ss << ':' << std::setw(2) << base_utc_offset().minutes(); if(base_utc_offset().seconds() != 0) { ss << ':' << std::setw(2) << base_utc_offset().seconds(); } } if(dst_calc_rules_ != no_rules) { // dst ss << dst_zone_abbrev(); // dst offset if(dst_offset().is_negative()) { // inverting the sign guarantees we get two digits ss << '-' << std::setw(2) << dst_offset().invert_sign().hours(); } else { ss << '+' << std::setw(2) << dst_offset().hours(); } if(dst_offset().minutes() != 0 || dst_offset().seconds() != 0) { ss << ':' << std::setw(2) << dst_offset().minutes(); if(dst_offset().seconds() != 0) { ss << ':' << std::setw(2) << dst_offset().seconds(); } } // start/time ss << ',' << date_time::convert_string_type
(dst_calc_rules_->start_rule_as_string()) << '/' << std::setw(2) << dst_offsets_.dst_start_offset_.hours() << ':' << std::setw(2) << dst_offsets_.dst_start_offset_.minutes(); if(dst_offsets_.dst_start_offset_.seconds() != 0) { ss << ':' << std::setw(2) << dst_offsets_.dst_start_offset_.seconds(); } // end/time ss << ',' << date_time::convert_string_type
(dst_calc_rules_->end_rule_as_string()) << '/' << std::setw(2) << dst_offsets_.dst_end_offset_.hours() << ':' << std::setw(2) << dst_offsets_.dst_end_offset_.minutes(); if(dst_offsets_.dst_end_offset_.seconds() != 0) { ss << ':' << std::setw(2) << dst_offsets_.dst_end_offset_.seconds(); } } return ss.str(); } private: time_zone_names zone_names_; bool has_dst_; time_duration_type base_utc_offset_; dst_adjustment_offsets dst_offsets_; boost::shared_ptr
dst_calc_rules_; }; typedef custom_time_zone_base
custom_time_zone; } }//namespace #endif
custom_time_zone.hpp
Page URL
File URL
Prev
2/10
Next
Download
( 6 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.