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 POSIXTIME_FORMATTERS_HPP___ #define POSIXTIME_FORMATTERS_HPP___ /* Copyright (c) 2002-2004 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 "boost/date_time/gregorian/gregorian.hpp" #include "boost/date_time/compiler_config.hpp" #include "boost/date_time/iso_format.hpp" #include "boost/date_time/date_format_simple.hpp" #include "boost/date_time/posix_time/posix_time_types.hpp" #include "boost/date_time/time_formatting_streams.hpp" #include "boost/date_time/time_parsing.hpp" /* NOTE: The "to_*_string" code for older compilers, ones that define * BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in * formatters_limited.hpp */ namespace boost { namespace posix_time { // template function called by wrapper functions: // to_*_string(time_duration) & to_*_wstring(time_duration) template
inline std::basic_string
to_simple_string_type(time_duration td) { std::basic_ostringstream
ss; if(td.is_special()) { /* simply using 'ss << td.get_rep()' won't work on compilers * that don't support locales. This way does. */ // switch copied from date_names_put.hpp switch(td.get_rep().as_special()) { case not_a_date_time: //ss << "not-a-number"; ss << "not-a-date-time"; break; case pos_infin: ss << "+infinity"; break; case neg_infin: ss << "-infinity"; break; default: ss << ""; } } else { charT fill_char = '0'; if(td.is_negative()) { ss << '-'; } ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.hours()) << ":"; ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.minutes()) << ":"; ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.seconds()); //TODO the following is totally non-generic, yelling FIXME #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) boost::int64_t frac_sec = date_time::absolute_value(td.fractional_seconds()); // JDG [7/6/02 VC++ compatibility] charT buff[32]; _i64toa(frac_sec, buff, 10); #else time_duration::fractional_seconds_type frac_sec = date_time::absolute_value(td.fractional_seconds()); #endif if (frac_sec != 0) { ss << "." << std::setw(time_duration::num_fractional_digits()) << std::setfill(fill_char) // JDG [7/6/02 VC++ compatibility] #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) << buff; #else << frac_sec; #endif } }// else return ss.str(); } //! Time duration to string -hh::mm::ss.fffffff. Example: 10:09:03.0123456 /*!\ingroup time_format */ inline std::string to_simple_string(time_duration td) { return to_simple_string_type
(td); } // template function called by wrapper functions: // to_*_string(time_duration) & to_*_wstring(time_duration) template
inline std::basic_string
to_iso_string_type(time_duration td) { std::basic_ostringstream
ss; if(td.is_special()) { /* simply using 'ss << td.get_rep()' won't work on compilers * that don't support locales. This way does. */ // switch copied from date_names_put.hpp switch(td.get_rep().as_special()) { case not_a_date_time: //ss << "not-a-number"; ss << "not-a-date-time"; break; case pos_infin: ss << "+infinity"; break; case neg_infin: ss << "-infinity"; break; default: ss << ""; } } else { charT fill_char = '0'; if(td.is_negative()) { ss << '-'; } ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.hours()); ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.minutes()); ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.seconds()); //TODO the following is totally non-generic, yelling FIXME #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) boost::int64_t frac_sec = date_time::absolute_value(td.fractional_seconds()); // JDG [7/6/02 VC++ compatibility] charT buff[32]; _i64toa(frac_sec, buff, 10); #else time_duration::fractional_seconds_type frac_sec = date_time::absolute_value(td.fractional_seconds()); #endif if (frac_sec != 0) { ss << "." << std::setw(time_duration::num_fractional_digits()) << std::setfill(fill_char) // JDG [7/6/02 VC++ compatibility] #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) << buff; #else << frac_sec; #endif } }// else return ss.str(); } //! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456 /*!\ingroup time_format */ inline std::string to_iso_string(time_duration td){ return to_iso_string_type
(td); } //! Time to simple format CCYY-mmm-dd hh:mm:ss.fffffff /*!\ingroup time_format */ template
inline std::basic_string
to_simple_string_type(ptime t) { // can't use this w/gcc295, no to_simple_string_type<>(td) available std::basic_string
ts = gregorian::to_simple_string_type
(t.date());// + " "; if(!t.time_of_day().is_special()) { charT space = ' '; return ts + space + to_simple_string_type
(t.time_of_day()); } else { return ts; } } inline std::string to_simple_string(ptime t){ return to_simple_string_type
(t); } // function called by wrapper functions to_*_string(time_period) // & to_*_wstring(time_period) template
inline std::basic_string
to_simple_string_type(time_period tp) { charT beg = '[', mid = '/', end = ']'; std::basic_string
d1(to_simple_string_type
(tp.begin())); std::basic_string
d2(to_simple_string_type
(tp.last())); return std::basic_string
(beg + d1 + mid + d2 + end); } //! Convert to string of form [YYYY-mmm-DD HH:MM::SS.ffffff/YYYY-mmm-DD HH:MM::SS.fffffff] /*!\ingroup time_format */ inline std::string to_simple_string(time_period tp){ return to_simple_string_type
(tp); } // function called by wrapper functions to_*_string(time_period) // & to_*_wstring(time_period) template
inline std::basic_string
to_iso_string_type(ptime t) { std::basic_string
ts = gregorian::to_iso_string_type
(t.date());// + "T"; if(!t.time_of_day().is_special()) { charT sep = 'T'; return ts + sep + to_iso_string_type
(t.time_of_day()); } else { return ts; } } //! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator /*!\ingroup time_format */ inline std::string to_iso_string(ptime t){ return to_iso_string_type
(t); } // function called by wrapper functions to_*_string(time_period) // & to_*_wstring(time_period) template
inline std::basic_string
to_iso_extended_string_type(ptime t) { std::basic_string
ts = gregorian::to_iso_extended_string_type
(t.date());// + "T"; if(!t.time_of_day().is_special()) { charT sep = 'T'; return ts + sep + to_simple_string_type
(t.time_of_day()); } else { return ts; } } //! Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator /*!\ingroup time_format */ inline std::string to_iso_extended_string(ptime t){ return to_iso_extended_string_type
(t); } #if !defined(BOOST_NO_STD_WSTRING) //! Time duration to wstring -hh::mm::ss.fffffff. Example: 10:09:03.0123456 /*!\ingroup time_format */ inline std::wstring to_simple_wstring(time_duration td) { return to_simple_string_type
(td); } //! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456 /*!\ingroup time_format */ inline std::wstring to_iso_wstring(time_duration td){ return to_iso_string_type
(td); } inline std::wstring to_simple_wstring(ptime t){ return to_simple_string_type
(t); } //! Convert to wstring of form [YYYY-mmm-DD HH:MM::SS.ffffff/YYYY-mmm-DD HH:MM::SS.fffffff] /*!\ingroup time_format */ inline std::wstring to_simple_wstring(time_period tp){ return to_simple_string_type
(tp); } //! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator /*!\ingroup time_format */ inline std::wstring to_iso_wstring(ptime t){ return to_iso_string_type
(t); } //! Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator /*!\ingroup time_format */ inline std::wstring to_iso_extended_wstring(ptime t){ return to_iso_extended_string_type
(t); } #endif // BOOST_NO_STD_WSTRING } } //namespace posix_time #endif
time_formatters.hpp
Page URL
File URL
Prev
11/15
Next
Download
( 9 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.