Compare commits

..

1 Commits

Author SHA1 Message Date
Beman Dawes 258f5e033a Release 1_46_0 beta 1
[SVN r68581]
2011-01-31 13:00:44 +00:00
174 changed files with 3095 additions and 4660 deletions
-116
View File
@@ -1,116 +0,0 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2017 - 2019 James E. King III
# Copyright 2019 - 2021 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
#
# Generic Appveyor build script for boostorg repositories
# See: https://github.com/boostorg/boost-ci/
#
# Instructions for customizing this script for your library:
#
# 1. Customize the compilers and language levels you want.
# 2. If you have more than include/, src/, test/, example/, examples/,
# benchmark/ or tools/ directories, set the environment variable DEPINST.
# For example if your build uses code in "bench/" and "fog/" directories:
# - DEPINST: --include bench --include fog
# 3. Enable pull request builds in your boostorg/<library> account.
#
# That's it - the script will do everything else for you.
#
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- master
- develop
- /bugfix\/.*/
- /feature\/.*/
- /fix\/.*/
- /pr\/.*/
matrix:
fast_finish: false
# Adding MAYFAIL to any matrix job allows it to fail but the build stays green:
allow_failures:
- MAYFAIL: true
environment:
global:
B2_CI_VERSION: 1
GIT_FETCH_JOBS: 4
# see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties
# to use the default for a given environment, comment it out; recommend you build debug and release however:
# on Windows it is important to exercise all the possibilities, especially shared vs static, however most
# libraries that care about this exercise it in their Jamfiles...
B2_ADDRESS_MODEL: 32,64
B2_LINK: shared,static
# B2_THREADING: threading=multi,single
B2_VARIANT: release
BOOST_DATE_TIME_TEST_WITHOUT_SELF_CONTAINED_HEADER_TESTS: 1
matrix:
- FLAVOR: Visual Studio 2017 C++2a Strict
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
B2_CXXFLAGS: -permissive-
B2_CXXSTD: 2a
B2_TOOLSET: msvc-14.1
- FLAVOR: Visual Studio 2017 C++14/17
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
B2_CXXSTD: 14,17
B2_TOOLSET: msvc-14.1
- FLAVOR: clang-cl
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
B2_ADDRESS_MODEL: 64
B2_CXXSTD: 11,14,17
B2_TOOLSET: clang-win
- FLAVOR: Visual Studio 2015, 2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
B2_TOOLSET: msvc-12.0,msvc-14.0
- FLAVOR: Visual Studio 2008, 2010, 2012
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
B2_TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0
B2_ADDRESS_MODEL: 32 # No 64bit support
- FLAVOR: cygwin (32-bit)
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ADDPATH: C:\cygwin\bin;
B2_ADDRESS_MODEL: 32
B2_CXXSTD: 03,11,14,1z
B2_THREADING: threadapi=pthread
B2_TOOLSET: gcc
- FLAVOR: cygwin (64-bit)
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ADDPATH: C:\cygwin64\bin;
B2_ADDRESS_MODEL: 64
B2_CXXSTD: 03,11,14,1z
B2_THREADING: threadapi=pthread
B2_TOOLSET: gcc
- FLAVOR: mingw64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ADDPATH: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;
B2_ADDRESS_MODEL: 64
B2_CXXSTD: 03,11,14,17,2a
B2_TOOLSET: gcc
install:
- git clone --depth 1 https://github.com/boostorg/boost-ci.git C:\boost-ci-cloned
# Copy ci folder if not testing Boost.CI
- if NOT "%APPVEYOR_PROJECT_NAME%" == "boost-ci" xcopy /s /e /q /i /y C:\boost-ci-cloned\ci .\ci
- rmdir /s /q C:\boost-ci-cloned
- ci\appveyor\install.bat
build: off
test_script: ci\build.bat
-23
View File
@@ -1,23 +0,0 @@
# Copyright 2019 - 2021 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
#
# Sample codecov configuration file. Edit as required
codecov:
max_report_age: off
require_ci_to_pass: yes
notify:
# Increase this if you have multiple coverage collection jobs
after_n_builds: 2
wait_for_ci: yes
# Change how pull request comments look
comment:
layout: "reach,diff,flags,files,footer"
# Ignore specific files or folders. Glob patterns are supported.
# See https://docs.codecov.com/docs/ignoring-paths
ignore:
- libs/date_time/test/
- test
-50
View File
@@ -1,50 +0,0 @@
#
# Copyright 2020-2021 Peter Dimov
# Copyright 2021 Andrey Semashev
# Copyright 2021-2024 Alexander Grund
# Copyright 2022-2025 James E. King III
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
#
# This workflow uses the Boost.CI reusable workflow which builds a variety of
# configurations of your project, runs tests, and generates code coverage reports.
#
# To use it, copy this file into your repository as `.github/workflows/ci.yml` and
# customize it appropriately.
#
---
name: Boost.CI
on:
pull_request:
push:
branches:
- master
- develop
- bugfix/**
- feature/**
- fix/**
- pr/**
paths-ignore:
- LICENSE
- meta/**
- README.md
jobs:
call-boost-ci:
name: Run Boost.CI
uses: boostorg/boost-ci/.github/workflows/reusable.yml@master
with:
# no endian branches
enable_multiarch: false
# serialization has issues, not enough time to add suppressions
enable_sanitizers: false
# these compilers fail
exclude_compiler: 'gcc-4.7,gcc-4.8,gcc-4.9,gcc-5,clang-3.5,clang-3.6,clang-3.7,clang-3.8'
# the tests take a while; this reduces the load a bit and there isn't any C++20 specific code
exclude_cxxstd: '98,03,0x,2a,20'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
-2
View File
@@ -1,2 +0,0 @@
**/test_facet_file.out
**/time_duration_serialization.*
-4
View File
@@ -1,4 +0,0 @@
# https://github.com/boostorg/serialization/issues/122
vptr:/usr/include/c++/*/bits/ios_base.h
# https://github.com/boostorg/serialization/issues/193
# could not figure out how to suppress it
-52
View File
@@ -1,52 +0,0 @@
# Generated by `boostdep --cmake date_time`
# Copyright 2020 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_date_time VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_date_time
src/gregorian/greg_month.cpp
)
add_library(Boost::date_time ALIAS boost_date_time)
target_include_directories(boost_date_time PUBLIC include)
target_link_libraries(boost_date_time
PUBLIC
Boost::algorithm
Boost::assert
Boost::config
Boost::core
Boost::io
Boost::lexical_cast
Boost::numeric_conversion
Boost::range
Boost::smart_ptr
Boost::throw_exception
Boost::tokenizer
Boost::type_traits
Boost::utility
Boost::winapi
)
target_compile_definitions(boost_date_time
PUBLIC BOOST_DATE_TIME_NO_LIB
PRIVATE BOOST_DATE_TIME_SOURCE
)
if(BUILD_SHARED_LIBS)
target_compile_definitions(boost_date_time PUBLIC BOOST_DATE_TIME_DYN_LINK)
else()
target_compile_definitions(boost_date_time PUBLIC BOOST_DATE_TIME_STATIC_LINK)
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()
-23
View File
@@ -1,23 +0,0 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-40
View File
@@ -1,40 +0,0 @@
DateTime, part of the collection of [Boost C++ Libraries](http://github.com/boostorg), makes programming with dates and times as simple and natural as programming with strings and integers.
### License
Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
### Properties
* C++11
* Header only
### Build Status
<!-- boost-ci/tools/makebadges.sh --repo date_time --appveyorbadge upf5c528fy09fudk --codecovbadge nDoh7t8f6g --coverity 14908 -->
| Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests |
| :-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- |
| [`master`](https://github.com/boostorg/date_time/tree/master) | [![Build Status](https://github.com/boostorg/date_time/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/date_time/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/upf5c528fy09fudk/branch/master?svg=true)](https://ci.appveyor.com/project/cppalliance/date-time/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14908/badge.svg)](https://scan.coverity.com/projects/boostorg-date_time) | [![codecov](https://codecov.io/gh/boostorg/date_time/branch/master/graph/badge.svg?token=nDoh7t8f6g)](https://codecov.io/gh/boostorg/date_time/tree/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/date_time.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/date_time) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](https://www.boost.org/development/tests/master/developer/date_time.html) |
| [`develop`](https://github.com/boostorg/date_time/tree/develop) | [![Build Status](https://github.com/boostorg/date_time/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/date_time/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/upf5c528fy09fudk/branch/develop?svg=true)](https://ci.appveyor.com/project/cppalliance/date-time/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14908/badge.svg)](https://scan.coverity.com/projects/boostorg-date_time) | [![codecov](https://codecov.io/gh/boostorg/date_time/branch/develop/graph/badge.svg?token=nDoh7t8f6g)](https://codecov.io/gh/boostorg/date_time/tree/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/date_time.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/date_time) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://www.boost.org/development/tests/develop/developer/date_time.html) |
### Directories
Note that the built library is only for build backward compatibility and contains no symbols. date_time is now header only.
| Name | Purpose |
| --------- | --------------------------------------- |
| `build` | build script for optional lib build |
| `data` | timezone database |
| `doc` | documentation |
| `example` | use case examples |
| `include` | headers |
| `src` | source code for optional link library |
| `test` | unit tests |
| `xmldoc` | documentation source |
### More information
* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-date_time): Be sure to read the documentation first to see if it answers your question.
* [Report bugs](https://github.com/boostorg/date_time/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
* [Submit Pull Requests](https://github.com/boostorg/date_time/pulls) against the **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). Be sure to include tests proving your changes work properly.
* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[date_time]` tag at the beginning of the subject line.
-37
View File
@@ -1,37 +0,0 @@
# Copyright René Ferdinand Rivera Morell 2023-2024
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.2 ;
constant boost_dependencies :
/boost/algorithm//boost_algorithm
/boost/assert//boost_assert
/boost/config//boost_config
/boost/core//boost_core
/boost/io//boost_io
/boost/lexical_cast//boost_lexical_cast
/boost/numeric_conversion//boost_numeric_conversion
/boost/range//boost_range
/boost/smart_ptr//boost_smart_ptr
/boost/throw_exception//boost_throw_exception
/boost/tokenizer//boost_tokenizer
/boost/type_traits//boost_type_traits
/boost/utility//boost_utility
/boost/winapi//boost_winapi ;
project /boost/date_time
: common-requirements
<include>include
;
explicit
[ alias boost_date_time : build//boost_date_time ]
[ alias all : boost_date_time example test ]
;
call-if : boost-library date_time
: install boost_date_time
;
+20 -10
View File
@@ -1,24 +1,34 @@
# Copyright (c) 2002-2005 CrystalClear Software, Inc.
# Use, modification and distribution is subject to the
# 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)
#
# date_time is now header only -- this file provides a stub for backward compatibility
# Boost.date_time build and test Jamfile
#
# Based on boost.python Jamfile
#
# To run all tests quietly: jam test
#
# Declares the following targets:
# 1. libboost_date_time, a static link library to be linked with all
# Boost.date_time modules
#
project
: common-requirements <library>$(boost_dependencies)
project boost/date_time
: requirements
<define>DATE_TIME_INLINE
<link>shared:<define>BOOST_ALL_DYN_LINK=1
: usage-requirements
<link>shared:<define>BOOST_ALL_DYN_LINK=1
<link>static:<define>BOOST_DATE_TIME_STATIC_LINK
: usage-requirements
<define>DATE_TIME_INLINE
<link>shared:<define>BOOST_DATE_TIME_DYN_LINK=1
<define>BOOST_DATE_TIME_NO_LINK=1
: source-location ../src
;
# greg_month.cpp is now just a stub so that there is
# still a boost_date_time library to link for backward compatibility
lib boost_date_time : gregorian/greg_month.cpp ;
# Base names of the source files for libboost_date_time
CPP_SOURCES = greg_month greg_weekday date_generators ;
lib boost_date_time : gregorian/$(CPP_SOURCES).cpp ;
boost-install boost_date_time ;
+101 -239
View File
@@ -3,7 +3,6 @@
"Africa/Accra","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Addis_Ababa","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Algiers","CET","CET","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Asmara","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Asmera","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Bamako","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Bangui","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
@@ -12,20 +11,19 @@
"Africa/Blantyre","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Brazzaville","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Bujumbura","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Cairo","EET","EET","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Casablanca","WET","WET","WEST","WEST","+00:00:00","+01:00:00","2;0;7","+02:00:00","-1;0;10","+03:00:00"
"Africa/Cairo","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;5;4","+00:00:00","-1;5;9","+00:00:00"
"Africa/Casablanca","WET","WET","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Ceuta","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Africa/Conakry","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Dakar","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Dar_es_Salaam","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Djibouti","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Douala","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/El_Aaiun","WET","WET","WEST","WEST","+00:00:00","+01:00:00","2;0;7","+02:00:00","-1;0;10","+03:00:00"
"Africa/El_Aaiun","WET","WET","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Freetown","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Gaborone","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Harare","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Johannesburg","SAST","SAST","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Juba","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Kampala","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Khartoum","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Kigali","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
@@ -48,62 +46,36 @@
"Africa/Nouakchott","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Ouagadougou","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Porto-Novo","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Porto_Novo","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Sao_Tome","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Timbuktu","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Tripoli","EET","EET","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Tunis","CET","CET","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Windhoek","WAT","WAT","WAST","WAST","+01:00:00","+01:00:00","1;0;9","+02:00:00","1;0;4","+02:00:00"
"America/Adak","HST","HST","HDT","HDT","-10:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Adak","HAST","HAST","HADT","HADT","-10:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Anchorage","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Anguilla","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Antigua","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Araguaina","BRT","BRT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Buenos_Aires","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Catamarca","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/ComodRivadavia","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Cordoba","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Jujuy","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/La_Rioja","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Mendoza","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Rio_Gallegos","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Salta","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/San_Juan","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/San_Luis","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Tucuman","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Ushuaia","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Araguaina","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Aruba","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Asuncion","PYT","PYT","PYST","PYST","-04:00:00","+01:00:00","1;0;10","+00:00:00","-1;0;3","+00:00:00"
"America/Atikokan","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Atka","HST","HST","HDT","HDT","-10:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Bahia","BRT","BRT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Bahia_Banderas","CST","CST","CDT","CDT","-06:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Asuncion","PYT","PYT","PYST","PYST","-04:00:00","+01:00:00","1;0;10","+00:00:00","1;0;3","+00:00:00"
"America/Barbados","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Belem","BRT","BRT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Belize","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Beulah","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Blanc-Sablon","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Blanc_Sablon","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Boa_Vista","AMT","AMT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Bogota","COT","COT","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Boise","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Buenos_Aires","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Cambridge_Bay","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Campo_Grande","AMT","AMT","AMST","AMST","-04:00:00","+01:00:00","3;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Cancun","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Caracas","VET","VET","","","-04:30:00","+00:00:00","","","","+00:00:00"
"America/Cancun","CST","CST","CDT","CDT","-06:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Caracas","VET","VET","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Catamarca","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Cayenne","GFT","GFT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Cayman","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Center","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Chicago","CST","Central Standard Time","CDT","Central Daylight Time","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Chihuahua","MST","MST","MDT","MDT","-07:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/ComodRivadavia","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Coral_Harbour","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Cordoba","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Costa_Rica","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Creston","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Cuiaba","AMT","AMT","AMST","AMST","-04:00:00","+01:00:00","3;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Cuiaba","AMT","AMT","AMST","AMST","-04:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Curacao","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Danmarkshavn","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"America/Dawson","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
@@ -114,30 +86,24 @@
"America/Edmonton","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Eirunepe","ACT","ACT","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/El_Salvador","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Ensenada","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Fortaleza","BRT","BRT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Fort_Wayne","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Fortaleza","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Glace_Bay","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Godthab","WGT","WGT","WGST","WGST","-03:00:00","+01:00:00","-1;6;3","+22:00:00","-1;6;10","+23:00:00"
"America/Goose_Bay","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Grand_Turk","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Goose_Bay","AST","AST","ADT","ADT","-04:00:00","+01:00:00","1;0;4","+00:01:00","-1;0;10","+00:01:00"
"America/Grand_Turk","EST","EST","EDT","EDT","-05:00:00","+01:00:00","1;0;4","+00:00:00","-1;0;10","+00:00:00"
"America/Grenada","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Guadeloupe","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Guatemala","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Guayaquil","ECT","ECT","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Guyana","GYT","GYT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Halifax","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Havana","CST","CST","CDT","CDT","-05:00:00","+01:00:00","2;0;3","+00:00:00","1;0;11","+01:00:00"
"America/Havana","CST","CST","CDT","CDT","-05:00:00","+01:00:00","1;0;4","+00:00:00","-1;0;10","+01:00:00"
"America/Hermosillo","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Indiana/Indianapolis","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Knox","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Marengo","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Petersburg","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Tell_City","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Vevay","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Vincennes","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Winamac","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indianapolis","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Indianapolis","EST","EST","","","-05:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Indiana/Knox","EST","EST","","","-05:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Indiana/Marengo","EST","EST","","","-05:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Indiana/Vevay","EST","EST","","","-05:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Indianapolis","EST","EST","","","-05:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Inuvik","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Iqaluit","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Jamaica","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
@@ -145,264 +111,174 @@
"America/Juneau","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Kentucky/Louisville","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Kentucky/Monticello","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Knox","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Knox_IN","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Kralendijk","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/La_Paz","BOT","BOT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/La_Rioja","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Lima","PET","PET","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Los_Angeles","PST","Pacific Standard Time","PDT","Pacific Daylight Time","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Louisville","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Lower_Princes","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Maceio","BRT","BRT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Maceio","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Managua","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Manaus","AMT","AMT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Marengo","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Marigot","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Martinique","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Matamoros","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Mazatlan","MST","MST","MDT","MDT","-07:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Mendoza","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Menominee","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Merida","CST","CST","CDT","CDT","-06:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Metlakatla","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Mexico_City","CST","CST","CDT","CDT","-06:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Miquelon","PMST","PMST","PMDT","PMDT","-03:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Moncton","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Monterrey","CST","CST","CDT","CDT","-06:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Montevideo","UYT","UYT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Monticello","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Montreal","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Montserrat","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Nassau","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/New_Salem","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Nassau","EST","EST","EDT","EDT","-05:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/New_York","EST","Eastern Standard Time","EDT","Eastern Daylight Time","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Nipigon","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Nome","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Noronha","FNT","FNT","","","-02:00:00","+00:00:00","","","","+00:00:00"
"America/North_Dakota/Beulah","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/North_Dakota/Center","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/North_Dakota/New_Salem","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Ojinaga","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Panama","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Pangnirtung","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Paramaribo","SRT","SRT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Petersburg","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Phoenix","MST","Mountain Standard Time","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Port-au-Prince","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Porto_Acre","ACT","ACT","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Porto_Velho","AMT","AMT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Port_au_Prince","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Port_of_Spain","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Porto_Velho","AMT","AMT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Puerto_Rico","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Rainy_River","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Rankin_Inlet","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Recife","BRT","BRT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Recife","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Regina","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Resolute","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Rio_Branco","ACT","ACT","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Rio_Gallegos","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Rosario","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Salta","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Santarem","BRT","BRT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Santa_Isabel","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Santiago","CLT","CLT","CLST","CLST","-04:00:00","+01:00:00","2;0;8","+00:00:00","3;0;5","+00:00:00"
"America/Santiago","CLT","CLT","CLST","CLST","-04:00:00","+01:00:00","2;0;10","+00:00:00","2;0;3","+00:00:00"
"America/Santo_Domingo","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/San_Juan","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/San_Luis","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Sao_Paulo","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","3;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Sao_Paulo","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Scoresbysund","EGT","EGT","EGST","EGST","-01:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+01:00:00"
"America/Shiprock","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Sitka","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/St_Barthelemy","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/St_Johns","NST","NST","NDT","NDT","-03:30:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/St_Johns","NST","NST","NDT","NDT","-03:30:00","+01:00:00","1;0;4","+00:01:00","-1;0;10","+00:01:00"
"America/St_Kitts","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/St_Lucia","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/St_Thomas","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/St_Vincent","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Swift_Current","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Tegucigalpa","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Tell_City","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Thule","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Thule","AST","AST","","","-04:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Thunder_Bay","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Tijuana","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Toronto","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Tijuana","PST","PST","PDT","PDT","-08:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Tortola","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Tucuman","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Ushuaia","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Vancouver","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Vevay","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Vincennes","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Virgin","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Whitehorse","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Winamac","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Winnipeg","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Winnipeg","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+03:00:00"
"America/Yakutat","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Yellowknife","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Antarctica/Casey","AWST","AWST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Casey","WST","WST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Davis","DAVT","DAVT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/DumontDUrville","DDUT","DDUT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Macquarie","MIST","MIST","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Mawson","MAWT","MAWT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/McMurdo","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","-1;0;9","+02:00:00","1;0;4","+03:00:00"
"Antarctica/Palmer","CLT","CLT","CLST","CLST","-04:00:00","+01:00:00","2;0;8","+00:00:00","3;0;5","+00:00:00"
"Antarctica/Rothera","ROTT","ROTT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/South_Pole","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","-1;0;9","+02:00:00","1;0;4","+03:00:00"
"Antarctica/Mawson","MAWT","MAWT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/McMurdo","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","1;0;10","+02:00:00","3;0;3","+03:00:00"
"Antarctica/Palmer","CLT","CLT","CLST","CLST","-04:00:00","+01:00:00","2;0;10","+00:00:00","2;0;3","+00:00:00"
"Antarctica/South_Pole","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","1;0;10","+02:00:00","3;0;3","+03:00:00"
"Antarctica/Syowa","SYOT","SYOT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Troll","UTC","UTC","CEST","CEST","+00:00:00","+02:00:00","-1;0;3","+01:00:00","-1;0;10","+03:00:00"
"Antarctica/Vostok","VOST","VOST","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Arctic/Longyearbyen","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Aden","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Almaty","ALMT","ALMT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Amman","EET","EET","EEST","EEST","+02:00:00","+01:00:00","1;5;4","+00:00:00","-1;5;10","+01:00:00"
"Asia/Anadyr","ANAT","ANAT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Asia/Aqtau","AQTT","AQTT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Aqtobe","AQTT","AQTT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Almaty","ALMT","ALMT","ALMST","ALMST","+06:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+00:00:00"
"Asia/Amman","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;4;3","+00:00:00","-1;4;9","+01:00:00"
"Asia/Anadyr","ANAT","ANAT","ANAST","ANAST","+12:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Aqtau","AQTT","AQTT","AQTST","AQTST","+04:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+00:00:00"
"Asia/Aqtobe","AQTT","AQTT","AQTST","AQTST","+05:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+00:00:00"
"Asia/Ashgabat","TMT","TMT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ashkhabad","TMT","TMT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Baghdad","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Baghdad","AST","AST","ADT","ADT","+03:00:00","+01:00:00","1;0;4","+03:00:00","1;0;10","+04:00:00"
"Asia/Bahrain","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Baku","AZT","AZT","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Baku","AZT","AZT","AZST","AZST","+04:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+01:00:00"
"Asia/Bangkok","ICT","ICT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Beirut","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+00:00:00"
"Asia/Bishkek","KGT","KGT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Bishkek","KGT","KGT","KGST","KGST","+05:00:00","+01:00:00","-1;0;3","+02:30:00","-1;0;10","+02:30:00"
"Asia/Brunei","BNT","BNT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Calcutta","IST","IST","","","+05:30:00","+00:00:00","","","","+00:00:00"
"Asia/Chita","YAKT","YAKT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Choibalsan","CHOT","CHOT","CHOST","CHOST","+08:00:00","+01:00:00","-1;6;3","+02:00:00","-1;6;9","+00:00:00"
"Asia/Choibalsan","CHOT","CHOT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Chongqing","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Chungking","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Colombo","IST","IST","","","+05:30:00","+00:00:00","","","","+00:00:00"
"Asia/Dacca","BDT","BDT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Damascus","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;5;3","+00:00:00","-1;5;10","+00:00:00"
"Asia/Colombo","LKT","LKT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Damascus","EET","EET","EEST","EEST","+02:00:00","+01:00:00","1;0;4","+00:00:00","1;0;10","+00:00:00"
"Asia/Dhaka","BDT","BDT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dili","TLT","TLT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dili","TPT","TPT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dubai","GST","GST","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dushanbe","TJT","TJT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Gaza","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;6;3","+01:00:00","3;5;10","+00:00:00"
"Asia/Gaza","EET","EET","EEST","EEST","+02:00:00","+01:00:00","3;5;4","+00:00:00","3;5;10","+00:00:00"
"Asia/Harbin","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Hebron","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;6;3","+01:00:00","3;5;10","+00:00:00"
"Asia/Hong_Kong","HKT","HKT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Hovd","HOVT","HOVT","HOVST","HOVST","+07:00:00","+01:00:00","-1;6;3","+02:00:00","-1;6;9","+00:00:00"
"Asia/Ho_Chi_Minh","ICT","ICT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Irkutsk","IRKT","IRKT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Hovd","HOVT","HOVT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Irkutsk","IRKT","IRKT","IRKST","IRKST","+08:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Istanbul","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Asia/Jakarta","WIB","WIB","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Jayapura","WIT","WIT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Jerusalem","IST","IST","IDT","IDT","+02:00:00","+01:00:00","-1;5;3","+02:00:00","-1;0;10","+02:00:00"
"Asia/Jakarta","WIT","WIT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Jayapura","EIT","EIT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Jerusalem","IST","IST","IDT","IDT","+02:00:00","+01:00:00","1;0;4","+01:00:00","1;0;10","+01:00:00"
"Asia/Kabul","AFT","AFT","","","+04:30:00","+00:00:00","","","","+00:00:00"
"Asia/Kamchatka","PETT","PETT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kamchatka","PETT","PETT","PETST","PETST","+12:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Karachi","PKT","PKT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kashgar","XJT","XJT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kathmandu","NPT","NPT","","","+05:45:00","+00:00:00","","","","+00:00:00"
"Asia/Kashgar","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Katmandu","NPT","NPT","","","+05:45:00","+00:00:00","","","","+00:00:00"
"Asia/Khandyga","YAKT","YAKT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kolkata","IST","IST","","","+05:30:00","+00:00:00","","","","+00:00:00"
"Asia/Krasnoyarsk","KRAT","KRAT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Krasnoyarsk","KRAT","KRAT","KRAST","KRAST","+07:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Kuala_Lumpur","MYT","MYT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kuching","MYT","MYT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kuwait","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Macao","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Macau","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Magadan","MAGT","MAGT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Asia/Makassar","WITA","WITA","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Magadan","MAGT","MAGT","MAGST","MAGST","+11:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Makassar","CIT","CIT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Manila","PHT","PHT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Muscat","GST","GST","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Nicosia","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Asia/Novokuznetsk","KRAT","KRAT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Novosibirsk","NOVT","NOVT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Omsk","OMST","OMST","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Oral","ORAT","ORAT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Novosibirsk","NOVT","NOVT","NOVST","NOVST","+06:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Omsk","OMST","OMST","OMSST","OMSST","+06:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Oral","WST","WST","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Phnom_Penh","ICT","ICT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Pontianak","WIB","WIB","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Pyongyang","KST","KST","","","+08:30:00","+00:00:00","","","","+00:00:00"
"Asia/Pontianak","WIT","WIT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Pyongyang","KST","KST","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Qyzylorda","KST","KST","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Qatar","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Qyzylorda","QYZT","QYZT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Rangoon","MMT","MMT","","","+06:30:00","+00:00:00","","","","+00:00:00"
"Asia/Riyadh","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Saigon","ICT","ICT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Sakhalin","SAKT","SAKT","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Asia/Sakhalin","SAKT","SAKT","SAKST","SAKST","+10:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Samarkand","UZT","UZT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Seoul","KST","KST","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Shanghai","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Singapore","SGT","SGT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Srednekolymsk","SRET","SRET","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Asia/Taipei","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tashkent","UZT","UZT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tbilisi","GET","GET","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tehran","IRST","IRST","IRDT","IRDT","+03:30:00","+01:00:00","3;1;3","+00:00:00","3;3;9","+00:00:00"
"Asia/Tel_Aviv","IST","IST","IDT","IDT","+02:00:00","+01:00:00","-1;5;3","+02:00:00","-1;0;10","+02:00:00"
"Asia/Thimbu","BTT","BTT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tbilisi","GET","GET","GEST","GEST","+04:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+00:00:00"
"Asia/Tehran","IRT","IRT","","","+03:30:00","+00:00:00","","","","+00:00:00"
"Asia/Thimphu","BTT","BTT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tokyo","JST","JST","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ujung_Pandang","WITA","WITA","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ulaanbaatar","ULAT","ULAT","ULAST","ULAST","+08:00:00","+01:00:00","-1;6;3","+02:00:00","-1;6;9","+00:00:00"
"Asia/Ulan_Bator","ULAT","ULAT","ULAST","ULAST","+08:00:00","+01:00:00","-1;6;3","+02:00:00","-1;6;9","+00:00:00"
"Asia/Urumqi","XJT","XJT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ust-Nera","VLAT","VLAT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ust_Nera","VLAT","VLAT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ujung_Pandang","CIT","CIT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ulaanbaatar","ULAT","ULAT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Urumqi","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Vientiane","ICT","ICT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Vladivostok","VLAT","VLAT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Asia/Yakutsk","YAKT","YAKT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Yekaterinburg","YEKT","YEKT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Yerevan","AMT","AMT","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Vladivostok","VLAT","VLAT","VLAST","VLAST","+10:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Yakutsk","YAKT","YAKT","YAKST","YAKST","+09:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Yekaterinburg","YEKT","YEKT","YEKST","YEKST","+05:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Yerevan","AMT","AMT","AMST","AMST","+04:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Atlantic/Azores","AZOT","AZOT","AZOST","AZOST","-01:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+01:00:00"
"Atlantic/Bermuda","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Atlantic/Bermuda","AST","AST","ADT","ADT","-04:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"Atlantic/Canary","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Atlantic/Cape_Verde","CVT","CVT","","","-01:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/Faeroe","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Atlantic/Faroe","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Atlantic/Jan_Mayen","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Atlantic/Madeira","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Atlantic/Reykjavik","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/South_Georgia","GST","GST","","","-02:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/Stanley","FKST","FKST","","","-03:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/St_Helena","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Australia/ACT","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Adelaide","ACST","ACST","ACDT","ACDT","+09:30:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Brisbane","AEST","AEST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Australia/Broken_Hill","ACST","ACST","ACDT","ACDT","+09:30:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Canberra","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Currie","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Darwin","ACST","ACST","","","+09:30:00","+00:00:00","","","","+00:00:00"
"Australia/Eucla","ACWST","ACWST","","","+08:45:00","+00:00:00","","","","+00:00:00"
"Australia/Hobart","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/LHI","LHST","LHST","LHDT","LHDT","+10:30:00","+00:30:00","1;0;10","+02:00:00","1;0;4","+02:00:00"
"Australia/Lindeman","AEST","AEST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Australia/Lord_Howe","LHST","LHST","LHDT","LHDT","+10:30:00","+00:30:00","1;0;10","+02:00:00","1;0;4","+02:00:00"
"Australia/Melbourne","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/North","ACST","ACST","","","+09:30:00","+00:00:00","","","","+00:00:00"
"Australia/NSW","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Perth","AWST","AWST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Australia/Queensland","AEST","AEST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Australia/South","ACST","ACST","ACDT","ACDT","+09:30:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Sydney","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Tasmania","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Victoria","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/West","AWST","AWST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Australia/Yancowinna","ACST","ACST","ACDT","ACDT","+09:30:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Brazil/Acre","ACT","ACT","","","-05:00:00","+00:00:00","","","","+00:00:00"
"Brazil/DeNoronha","FNT","FNT","","","-02:00:00","+00:00:00","","","","+00:00:00"
"Brazil/East","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","3;0;10","+00:00:00","3;0;2","+00:00:00"
"Brazil/West","AMT","AMT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"Canada/Atlantic","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Canada/Central","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Canada/East-Saskatchewan","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"Canada/Eastern","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Canada/East_Saskatchewan","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"Canada/Mountain","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Canada/Newfoundland","NST","NST","NDT","NDT","-03:30:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Canada/Pacific","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Canada/Saskatchewan","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"Canada/Yukon","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Chile/Continental","CLT","CLT","CLST","CLST","-04:00:00","+01:00:00","2;0;8","+00:00:00","3;0;5","+00:00:00"
"Chile/EasterIsland","EAST","EAST","EASST","EASST","-06:00:00","+01:00:00","2;6;8","+22:00:00","2;6;5","+22:00:00"
"Etc/GMT","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Etc/Greenwich","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Etc/UCT","UCT","UCT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Etc/Universal","UTC","UTC","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Etc/UTC","UTC","UTC","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Etc/Zulu","UTC","UTC","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/Stanley","FKT","FKT","FKST","FKST","-04:00:00","+01:00:00","1;0;9","+02:00:00","3;0;4","+02:00:00"
"Australia/Adelaide","CST","CST","CST","CST","+09:30:00","+01:00:00","-1;0;10","+02:00:00","-1;0;3","+03:00:00"
"Australia/Brisbane","EST","EST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Australia/Broken_Hill","CST","CST","CST","CST","+09:30:00","+01:00:00","-1;0;10","+02:00:00","-1;0;3","+03:00:00"
"Australia/Darwin","CST","CST","","","+09:30:00","+00:00:00","","","","+00:00:00"
"Australia/Hobart","EST","EST","EST","EST","+10:00:00","+01:00:00","1;0;10","+02:00:00","-1;0;3","+03:00:00"
"Australia/Lindeman","EST","EST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Australia/Lord_Howe","LHST","LHST","LHST","LHST","+10:30:00","+00:30:00","-1;0;10","+02:00:00","-1;0;3","+02:00:00"
"Australia/Melbourne","EST","EST","EST","EST","+10:00:00","+01:00:00","-1;0;10","+02:00:00","-1;0;3","+03:00:00"
"Australia/Perth","WST","WST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Australia/Sydney","EST","EST","EST","EST","+10:00:00","+01:00:00","-1;0;10","+02:00:00","-1;0;3","+03:00:00"
"Europe/Amsterdam","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Andorra","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Athens","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
@@ -413,17 +289,13 @@
"Europe/Brussels","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Bucharest","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Budapest","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Busingen","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Chisinau","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Chisinau","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Copenhagen","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Dublin","GMT","GMT","IST","IST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Gibraltar","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Guernsey","GMT","GMT","BST","BST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Helsinki","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Isle_of_Man","GMT","GMT","BST","BST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Istanbul","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Jersey","GMT","GMT","BST","BST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Kaliningrad","EET","EET","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Europe/Kaliningrad","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Kiev","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Lisbon","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Ljubljana","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
@@ -431,33 +303,29 @@
"Europe/Luxembourg","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Madrid","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Malta","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Mariehamn","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Minsk","MSK","MSK","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Europe/Minsk","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Monaco","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Moscow","MSK","MSK","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Europe/Moscow","MSK","MSK","MSD","MSD","+03:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Nicosia","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Oslo","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Paris","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Podgorica","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Prague","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Riga","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Rome","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Samara","SAMT","SAMT","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Europe/Samara","SAMT","SAMT","SAMST","SAMST","+04:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/San_Marino","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Sarajevo","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Simferopol","MSK","MSK","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Europe/Simferopol","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Skopje","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Sofia","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Stockholm","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Tallinn","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Tallinn","EET","EET","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Europe/Tirane","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Tiraspol","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Uzhgorod","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Vaduz","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Vatican","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Vienna","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Vilnius","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Volgograd","MSK","MSK","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Europe/Vilnius","EET","EET","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Europe/Warsaw","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Zagreb","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Zaporozhye","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
@@ -473,18 +341,14 @@
"Indian/Mauritius","MUT","MUT","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Indian/Mayotte","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Indian/Reunion","RET","RET","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Mexico/BajaNorte","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Mexico/BajaSur","MST","MST","MDT","MDT","-07:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"Mexico/General","CST","CST","CDT","CDT","-06:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"Pacific/Apia","WSST","WSST","WSDT","WSDT","+13:00:00","+01:00:00","-1;0;9","+03:00:00","1;0;4","+04:00:00"
"Pacific/Auckland","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","-1;0;9","+02:00:00","1;0;4","+03:00:00"
"Pacific/Chatham","CHAST","CHAST","CHADT","CHADT","+12:45:00","+01:00:00","-1;0;9","+02:00:00","1;0;4","+03:00:00"
"Pacific/Chuuk","CHUT","CHUT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Easter","EAST","EAST","EASST","EASST","-06:00:00","+01:00:00","2;6;8","+22:00:00","2;6;5","+22:00:00"
"Pacific/Apia","WST","WST","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Auckland","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","1;0;10","+02:00:00","3;0;3","+03:00:00"
"Pacific/Chatham","CHAST","CHAST","CHADT","CHADT","+12:45:00","+01:00:00","1;0;10","+02:45:00","3;0;3","+03:45:00"
"Pacific/Easter","EAST","EAST","EASST","EASST","-06:00:00","+01:00:00","2;6;10","+22:00:00","2;6;3","+22:00:00"
"Pacific/Efate","VUT","VUT","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Enderbury","PHOT","PHOT","","","+13:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Fakaofo","TKT","TKT","","","+13:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Fiji","FJT","FJT","FJST","FJST","+12:00:00","+01:00:00","1;0;11","+02:00:00","3;0;1","+03:00:00"
"Pacific/Fakaofo","TKT","TKT","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Fiji","FJT","FJT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Funafuti","TVT","TVT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Galapagos","GALT","GALT","","","-06:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Gambier","GAMT","GAMT","","","-09:00:00","+00:00:00","","","","+00:00:00"
@@ -500,21 +364,19 @@
"Pacific/Midway","SST","SST","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Nauru","NRT","NRT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Niue","NUT","NUT","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Norfolk","NFT","NFT","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Norfolk","NFT","NFT","","","+11:30:00","+00:00:00","","","","+00:00:00"
"Pacific/Noumea","NCT","NCT","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Pago_Pago","SST","SST","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Palau","PWT","PWT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Pitcairn","PST","PST","","","-08:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Pohnpei","PONT","PONT","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Ponape","PONT","PONT","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Port_Moresby","PGT","PGT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Rarotonga","CKT","CKT","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Saipan","ChST","ChST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Samoa","SST","SST","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Tahiti","TAHT","TAHT","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Tarawa","GILT","GILT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Tongatapu","TOT","TOT","","","+13:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Truk","CHUT","CHUT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Truk","TRUT","TRUT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Wake","WAKT","WAKT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Wallis","WFT","WFT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Yap","CHUT","CHUT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Yap","YAPT","YAPT","","","+10:00:00","+00:00:00","","","","+00:00:00"
1 ID STD ABBR STD NAME DST ABBR DST NAME GMT offset DST adjustment DST Start Date rule Start time DST End date rule End time
3 Africa/Accra GMT GMT +00:00:00 +00:00:00 +00:00:00
4 Africa/Addis_Ababa EAT EAT +03:00:00 +00:00:00 +00:00:00
5 Africa/Algiers CET CET +01:00:00 +00:00:00 +00:00:00
Africa/Asmara EAT EAT +03:00:00 +00:00:00 +00:00:00
6 Africa/Asmera EAT EAT +03:00:00 +00:00:00 +00:00:00
7 Africa/Bamako GMT GMT +00:00:00 +00:00:00 +00:00:00
8 Africa/Bangui WAT WAT +01:00:00 +00:00:00 +00:00:00
11 Africa/Blantyre CAT CAT +02:00:00 +00:00:00 +00:00:00
12 Africa/Brazzaville WAT WAT +01:00:00 +00:00:00 +00:00:00
13 Africa/Bujumbura CAT CAT +02:00:00 +00:00:00 +00:00:00
14 Africa/Cairo EET EET EEST EEST +02:00:00 +00:00:00 +01:00:00 -1;5;4 +00:00:00 -1;5;9 +00:00:00
15 Africa/Casablanca WET WET WEST WEST +00:00:00 +01:00:00 +00:00:00 2;0;7 +02:00:00 -1;0;10 +03:00:00 +00:00:00
16 Africa/Ceuta CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
17 Africa/Conakry GMT GMT +00:00:00 +00:00:00 +00:00:00
18 Africa/Dakar GMT GMT +00:00:00 +00:00:00 +00:00:00
19 Africa/Dar_es_Salaam EAT EAT +03:00:00 +00:00:00 +00:00:00
20 Africa/Djibouti EAT EAT +03:00:00 +00:00:00 +00:00:00
21 Africa/Douala WAT WAT +01:00:00 +00:00:00 +00:00:00
22 Africa/El_Aaiun WET WET WEST WEST +00:00:00 +01:00:00 +00:00:00 2;0;7 +02:00:00 -1;0;10 +03:00:00 +00:00:00
23 Africa/Freetown GMT GMT +00:00:00 +00:00:00 +00:00:00
24 Africa/Gaborone CAT CAT +02:00:00 +00:00:00 +00:00:00
25 Africa/Harare CAT CAT +02:00:00 +00:00:00 +00:00:00
26 Africa/Johannesburg SAST SAST +02:00:00 +00:00:00 +00:00:00
Africa/Juba EAT EAT +03:00:00 +00:00:00 +00:00:00
27 Africa/Kampala EAT EAT +03:00:00 +00:00:00 +00:00:00
28 Africa/Khartoum EAT EAT +03:00:00 +00:00:00 +00:00:00
29 Africa/Kigali CAT CAT +02:00:00 +00:00:00 +00:00:00
46 Africa/Nouakchott GMT GMT +00:00:00 +00:00:00 +00:00:00
47 Africa/Ouagadougou GMT GMT +00:00:00 +00:00:00 +00:00:00
48 Africa/Porto-Novo WAT WAT +01:00:00 +00:00:00 +00:00:00
Africa/Porto_Novo WAT WAT +01:00:00 +00:00:00 +00:00:00
49 Africa/Sao_Tome GMT GMT +00:00:00 +00:00:00 +00:00:00
50 Africa/Timbuktu GMT GMT +00:00:00 +00:00:00 +00:00:00
51 Africa/Tripoli EET EET +02:00:00 +00:00:00 +00:00:00
52 Africa/Tunis CET CET +01:00:00 +00:00:00 +00:00:00
53 Africa/Windhoek WAT WAT WAST WAST +01:00:00 +01:00:00 1;0;9 +02:00:00 1;0;4 +02:00:00
54 America/Adak HST HAST HST HAST HDT HADT HDT HADT -10:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
55 America/Anchorage AKST AKST AKDT AKDT -09:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
56 America/Anguilla AST AST -04:00:00 +00:00:00 +00:00:00
57 America/Antigua AST AST -04:00:00 +00:00:00 +00:00:00
58 America/Araguaina BRT BRT BRST BRST -03:00:00 +00:00:00 +01:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
America/Argentina/Buenos_Aires ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/Catamarca ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/ComodRivadavia ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/Cordoba ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/Jujuy ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/La_Rioja ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/Mendoza ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/Rio_Gallegos ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/Salta ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/San_Juan ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/San_Luis ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/Tucuman ART ART -03:00:00 +00:00:00 +00:00:00
America/Argentina/Ushuaia ART ART -03:00:00 +00:00:00 +00:00:00
59 America/Aruba AST AST -04:00:00 +00:00:00 +00:00:00
60 America/Asuncion PYT PYT PYST PYST -04:00:00 +01:00:00 1;0;10 +00:00:00 -1;0;3 1;0;3 +00:00:00
America/Atikokan EST EST -05:00:00 +00:00:00 +00:00:00
America/Atka HST HST HDT HDT -10:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Bahia BRT BRT -03:00:00 +00:00:00 +00:00:00
America/Bahia_Banderas CST CST CDT CDT -06:00:00 +01:00:00 1;0;4 +02:00:00 -1;0;10 +02:00:00
61 America/Barbados AST AST -04:00:00 +00:00:00 +00:00:00
62 America/Belem BRT BRT -03:00:00 +00:00:00 +00:00:00
63 America/Belize CST CST -06:00:00 +00:00:00 +00:00:00
America/Beulah CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Blanc-Sablon AST AST -04:00:00 +00:00:00 +00:00:00
America/Blanc_Sablon AST AST -04:00:00 +00:00:00 +00:00:00
64 America/Boa_Vista AMT AMT -04:00:00 +00:00:00 +00:00:00
65 America/Bogota COT COT -05:00:00 +00:00:00 +00:00:00
66 America/Boise MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
67 America/Buenos_Aires ART ART -03:00:00 +00:00:00 +00:00:00
68 America/Cambridge_Bay MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
69 America/Campo_Grande America/Cancun AMT CST AMT CST AMST CDT AMST CDT -04:00:00 -06:00:00 +01:00:00 3;0;10 1;0;4 +00:00:00 +02:00:00 3;0;2 -1;0;10 +00:00:00 +02:00:00
70 America/Cancun America/Caracas EST VET EST VET -05:00:00 -04:00:00 +00:00:00 +00:00:00
America/Caracas VET VET -04:30:00 +00:00:00 +00:00:00
71 America/Catamarca ART ART -03:00:00 +00:00:00 +00:00:00
72 America/Cayenne GFT GFT -03:00:00 +00:00:00 +00:00:00
73 America/Cayman EST EST -05:00:00 +00:00:00 +00:00:00
America/Center CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
74 America/Chicago CST Central Standard Time CDT Central Daylight Time -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
75 America/Chihuahua MST MST MDT MDT -07:00:00 +01:00:00 1;0;4 +02:00:00 -1;0;10 +02:00:00
America/ComodRivadavia ART ART -03:00:00 +00:00:00 +00:00:00
America/Coral_Harbour EST EST -05:00:00 +00:00:00 +00:00:00
76 America/Cordoba ART ART -03:00:00 +00:00:00 +00:00:00
77 America/Costa_Rica CST CST -06:00:00 +00:00:00 +00:00:00
78 America/Creston America/Cuiaba MST AMT MST AMT AMST AMST -07:00:00 -04:00:00 +00:00:00 +01:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
America/Cuiaba AMT AMT AMST AMST -04:00:00 +01:00:00 3;0;10 +00:00:00 3;0;2 +00:00:00
79 America/Curacao AST AST -04:00:00 +00:00:00 +00:00:00
80 America/Danmarkshavn GMT GMT +00:00:00 +00:00:00 +00:00:00
81 America/Dawson PST PST PDT PDT -08:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
86 America/Edmonton MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
87 America/Eirunepe ACT ACT -05:00:00 +00:00:00 +00:00:00
88 America/El_Salvador CST CST -06:00:00 +00:00:00 +00:00:00
89 America/Ensenada America/Fortaleza PST BRT PST BRT PDT BRST PDT BRST -08:00:00 -03:00:00 +01:00:00 2;0;3 2;0;10 +02:00:00 +00:00:00 1;0;11 3;0;2 +02:00:00 +00:00:00
America/Fortaleza BRT BRT -03:00:00 +00:00:00 +00:00:00
America/Fort_Wayne EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
90 America/Glace_Bay AST AST ADT ADT -04:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
91 America/Godthab WGT WGT WGST WGST -03:00:00 +01:00:00 -1;6;3 +22:00:00 -1;6;10 +23:00:00
92 America/Goose_Bay AST AST ADT ADT -04:00:00 +01:00:00 2;0;3 1;0;4 +02:00:00 +00:01:00 1;0;11 -1;0;10 +02:00:00 +00:01:00
93 America/Grand_Turk AST EST AST EST EDT EDT -04:00:00 -05:00:00 +00:00:00 +01:00:00 1;0;4 +00:00:00 -1;0;10 +00:00:00
94 America/Grenada AST AST -04:00:00 +00:00:00 +00:00:00
95 America/Guadeloupe AST AST -04:00:00 +00:00:00 +00:00:00
96 America/Guatemala CST CST -06:00:00 +00:00:00 +00:00:00
97 America/Guayaquil ECT ECT -05:00:00 +00:00:00 +00:00:00
98 America/Guyana GYT GYT -04:00:00 +00:00:00 +00:00:00
99 America/Halifax AST AST ADT ADT -04:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
100 America/Havana CST CST CDT CDT -05:00:00 +01:00:00 2;0;3 1;0;4 +00:00:00 1;0;11 -1;0;10 +01:00:00
101 America/Hermosillo MST MST -07:00:00 +00:00:00 +00:00:00
102 America/Indiana/Indianapolis EST EST EDT EDT -05:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
103 America/Indiana/Knox CST EST CST EST CDT CDT -06:00:00 -05:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
104 America/Indiana/Marengo EST EST EDT EDT -05:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
105 America/Indiana/Petersburg America/Indiana/Vevay EST EST EDT EDT -05:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
106 America/Indiana/Tell_City America/Indianapolis CST EST CST EST CDT CDT -06:00:00 -05:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
America/Indiana/Vevay EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Indiana/Vincennes EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Indiana/Winamac EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Indianapolis EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
107 America/Inuvik MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
108 America/Iqaluit EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
109 America/Jamaica EST EST -05:00:00 +00:00:00 +00:00:00
111 America/Juneau AKST AKST AKDT AKDT -09:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
112 America/Kentucky/Louisville EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
113 America/Kentucky/Monticello EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Knox CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Knox_IN CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Kralendijk AST AST -04:00:00 +00:00:00 +00:00:00
114 America/La_Paz BOT BOT -04:00:00 +00:00:00 +00:00:00
America/La_Rioja ART ART -03:00:00 +00:00:00 +00:00:00
115 America/Lima PET PET -05:00:00 +00:00:00 +00:00:00
116 America/Los_Angeles PST Pacific Standard Time PDT Pacific Daylight Time -08:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
117 America/Louisville EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
118 America/Lower_Princes America/Maceio AST BRT AST BRT BRST BRST -04:00:00 -03:00:00 +00:00:00 +01:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
America/Maceio BRT BRT -03:00:00 +00:00:00 +00:00:00
119 America/Managua CST CST -06:00:00 +00:00:00 +00:00:00
120 America/Manaus AMT AMT -04:00:00 +00:00:00 +00:00:00
America/Marengo EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Marigot AST AST -04:00:00 +00:00:00 +00:00:00
121 America/Martinique AST AST -04:00:00 +00:00:00 +00:00:00
America/Matamoros CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
122 America/Mazatlan MST MST MDT MDT -07:00:00 +01:00:00 1;0;4 +02:00:00 -1;0;10 +02:00:00
123 America/Mendoza ART ART -03:00:00 +00:00:00 +00:00:00
124 America/Menominee CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
125 America/Merida CST CST CDT CDT -06:00:00 +01:00:00 1;0;4 +02:00:00 -1;0;10 +02:00:00
America/Metlakatla AKST AKST AKDT AKDT -09:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
126 America/Mexico_City CST CST CDT CDT -06:00:00 +01:00:00 1;0;4 +02:00:00 -1;0;10 +02:00:00
127 America/Miquelon PMST PMST PMDT PMDT -03:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Moncton AST AST ADT ADT -04:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
128 America/Monterrey CST CST CDT CDT -06:00:00 +01:00:00 1;0;4 +02:00:00 -1;0;10 +02:00:00
129 America/Montevideo UYT UYT -03:00:00 +00:00:00 +00:00:00
America/Monticello EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
130 America/Montreal EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
131 America/Montserrat AST AST -04:00:00 +00:00:00 +00:00:00
132 America/Nassau EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 1;0;4 +02:00:00 1;0;11 -1;0;10 +02:00:00
America/New_Salem CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
133 America/New_York EST Eastern Standard Time EDT Eastern Daylight Time -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
134 America/Nipigon EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
135 America/Nome AKST AKST AKDT AKDT -09:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
136 America/Noronha FNT FNT -02:00:00 +00:00:00 +00:00:00
America/North_Dakota/Beulah CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
137 America/North_Dakota/Center CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/North_Dakota/New_Salem CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Ojinaga MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
138 America/Panama EST EST -05:00:00 +00:00:00 +00:00:00
139 America/Pangnirtung EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
140 America/Paramaribo SRT SRT -03:00:00 +00:00:00 +00:00:00
America/Petersburg EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
141 America/Phoenix MST Mountain Standard Time -07:00:00 +00:00:00 +00:00:00
142 America/Port-au-Prince EST EST -05:00:00 +00:00:00 +00:00:00
America/Porto_Acre ACT ACT -05:00:00 +00:00:00 +00:00:00
America/Porto_Velho AMT AMT -04:00:00 +00:00:00 +00:00:00
America/Port_au_Prince EST EST -05:00:00 +00:00:00 +00:00:00
143 America/Port_of_Spain AST AST -04:00:00 +00:00:00 +00:00:00
144 America/Porto_Velho AMT AMT -04:00:00 +00:00:00 +00:00:00
145 America/Puerto_Rico AST AST -04:00:00 +00:00:00 +00:00:00
146 America/Rainy_River CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
147 America/Rankin_Inlet CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
148 America/Recife BRT BRT BRST BRST -03:00:00 +00:00:00 +01:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
149 America/Regina CST CST -06:00:00 +00:00:00 +00:00:00
America/Resolute CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
150 America/Rio_Branco ACT ACT -05:00:00 +00:00:00 +00:00:00
America/Rio_Gallegos ART ART -03:00:00 +00:00:00 +00:00:00
151 America/Rosario ART ART -03:00:00 +00:00:00 +00:00:00
152 America/Salta America/Santiago ART CLT ART CLT CLST CLST -03:00:00 -04:00:00 +00:00:00 +01:00:00 2;0;10 +00:00:00 2;0;3 +00:00:00
America/Santarem BRT BRT -03:00:00 +00:00:00 +00:00:00
America/Santa_Isabel PST PST PDT PDT -08:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Santiago CLT CLT CLST CLST -04:00:00 +01:00:00 2;0;8 +00:00:00 3;0;5 +00:00:00
153 America/Santo_Domingo AST AST -04:00:00 +00:00:00 +00:00:00
154 America/San_Juan America/Sao_Paulo ART BRT ART BRT BRST BRST -03:00:00 +00:00:00 +01:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
America/San_Luis ART ART -03:00:00 +00:00:00 +00:00:00
America/Sao_Paulo BRT BRT BRST BRST -03:00:00 +01:00:00 3;0;10 +00:00:00 3;0;2 +00:00:00
155 America/Scoresbysund EGT EGT EGST EGST -01:00:00 +01:00:00 -1;0;3 +00:00:00 -1;0;10 +01:00:00
156 America/Shiprock MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
157 America/Sitka America/St_Johns AKST NST AKST NST AKDT NDT AKDT NDT -09:00:00 -03:30:00 +01:00:00 2;0;3 1;0;4 +02:00:00 +00:01:00 1;0;11 -1;0;10 +02:00:00 +00:01:00
America/St_Barthelemy AST AST -04:00:00 +00:00:00 +00:00:00
America/St_Johns NST NST NDT NDT -03:30:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
158 America/St_Kitts AST AST -04:00:00 +00:00:00 +00:00:00
159 America/St_Lucia AST AST -04:00:00 +00:00:00 +00:00:00
160 America/St_Thomas AST AST -04:00:00 +00:00:00 +00:00:00
161 America/St_Vincent AST AST -04:00:00 +00:00:00 +00:00:00
162 America/Swift_Current CST CST -06:00:00 +00:00:00 +00:00:00
163 America/Tegucigalpa CST CST -06:00:00 +00:00:00 +00:00:00
164 America/Tell_City America/Thule CST AST CST AST CDT CDT -06:00:00 -04:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
America/Thule AST AST ADT ADT -04:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
165 America/Thunder_Bay EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
166 America/Tijuana PST PST PDT PDT -08:00:00 +01:00:00 2;0;3 1;0;4 +02:00:00 1;0;11 -1;0;10 +02:00:00
America/Toronto EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
167 America/Tortola AST AST -04:00:00 +00:00:00 +00:00:00
America/Tucuman ART ART -03:00:00 +00:00:00 +00:00:00
America/Ushuaia ART ART -03:00:00 +00:00:00 +00:00:00
168 America/Vancouver PST PST PDT PDT -08:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Vevay EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Vincennes EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Virgin AST AST -04:00:00 +00:00:00 +00:00:00
169 America/Whitehorse PST PST PDT PDT -08:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
170 America/Winamac America/Winnipeg EST CST EST CST EDT CDT EDT CDT -05:00:00 -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +03:00:00
America/Winnipeg CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
171 America/Yakutat AKST AKST AKDT AKDT -09:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
172 America/Yellowknife MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
173 Antarctica/Casey AWST WST AWST WST +08:00:00 +00:00:00 +00:00:00
174 Antarctica/Davis DAVT DAVT +07:00:00 +00:00:00 +00:00:00
175 Antarctica/DumontDUrville DDUT DDUT +10:00:00 +00:00:00 +00:00:00
176 Antarctica/Macquarie Antarctica/Mawson MIST MAWT MIST MAWT +11:00:00 +06:00:00 +00:00:00 +00:00:00
177 Antarctica/Mawson Antarctica/McMurdo MAWT NZST MAWT NZST NZDT NZDT +05:00:00 +12:00:00 +00:00:00 +01:00:00 1;0;10 +02:00:00 3;0;3 +00:00:00 +03:00:00
178 Antarctica/McMurdo Antarctica/Palmer NZST CLT NZST CLT NZDT CLST NZDT CLST +12:00:00 -04:00:00 +01:00:00 -1;0;9 2;0;10 +02:00:00 +00:00:00 1;0;4 2;0;3 +03:00:00 +00:00:00
179 Antarctica/Palmer Antarctica/South_Pole CLT NZST CLT NZST CLST NZDT CLST NZDT -04:00:00 +12:00:00 +01:00:00 2;0;8 1;0;10 +00:00:00 +02:00:00 3;0;5 3;0;3 +00:00:00 +03:00:00
Antarctica/Rothera ROTT ROTT -03:00:00 +00:00:00 +00:00:00
Antarctica/South_Pole NZST NZST NZDT NZDT +12:00:00 +01:00:00 -1;0;9 +02:00:00 1;0;4 +03:00:00
180 Antarctica/Syowa SYOT SYOT +03:00:00 +00:00:00 +00:00:00
Antarctica/Troll UTC UTC CEST CEST +00:00:00 +02:00:00 -1;0;3 +01:00:00 -1;0;10 +03:00:00
181 Antarctica/Vostok VOST VOST +06:00:00 +00:00:00 +00:00:00
182 Arctic/Longyearbyen CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
183 Asia/Aden AST AST +03:00:00 +00:00:00 +00:00:00
184 Asia/Almaty ALMT ALMT ALMST ALMST +06:00:00 +00:00:00 +01:00:00 -1;0;3 +00:00:00 -1;0;10 +00:00:00
185 Asia/Amman EET EET EEST EEST +02:00:00 +01:00:00 1;5;4 -1;4;3 +00:00:00 -1;5;10 -1;4;9 +01:00:00
186 Asia/Anadyr ANAT ANAT ANAST ANAST +12:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
187 Asia/Aqtau AQTT AQTT AQTST AQTST +05:00:00 +04:00:00 +00:00:00 +01:00:00 -1;0;3 +00:00:00 -1;0;10 +00:00:00
188 Asia/Aqtobe AQTT AQTT AQTST AQTST +05:00:00 +00:00:00 +01:00:00 -1;0;3 +00:00:00 -1;0;10 +00:00:00
189 Asia/Ashgabat TMT TMT +05:00:00 +00:00:00 +00:00:00
190 Asia/Ashkhabad Asia/Baghdad TMT AST TMT AST ADT ADT +05:00:00 +03:00:00 +00:00:00 +01:00:00 1;0;4 +03:00:00 1;0;10 +00:00:00 +04:00:00
Asia/Baghdad AST AST +03:00:00 +00:00:00 +00:00:00
191 Asia/Bahrain AST AST +03:00:00 +00:00:00 +00:00:00
192 Asia/Baku AZT AZT AZST AZST +04:00:00 +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +00:00:00 +01:00:00
193 Asia/Bangkok ICT ICT +07:00:00 +00:00:00 +00:00:00
194 Asia/Beirut EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +00:00:00 -1;0;10 +00:00:00
195 Asia/Bishkek KGT KGT KGST KGST +06:00:00 +05:00:00 +00:00:00 +01:00:00 -1;0;3 +02:30:00 -1;0;10 +00:00:00 +02:30:00
196 Asia/Brunei BNT BNT +08:00:00 +00:00:00 +00:00:00
197 Asia/Calcutta IST IST +05:30:00 +00:00:00 +00:00:00
198 Asia/Chita Asia/Choibalsan YAKT CHOT YAKT CHOT +09:00:00 +00:00:00 +00:00:00
Asia/Choibalsan CHOT CHOT CHOST CHOST +08:00:00 +01:00:00 -1;6;3 +02:00:00 -1;6;9 +00:00:00
199 Asia/Chongqing CST CST +08:00:00 +00:00:00 +00:00:00
200 Asia/Chungking Asia/Colombo CST LKT CST LKT +08:00:00 +06:00:00 +00:00:00 +00:00:00
201 Asia/Colombo Asia/Damascus IST EET IST EET EEST EEST +05:30:00 +02:00:00 +00:00:00 +01:00:00 1;0;4 +00:00:00 1;0;10 +00:00:00
Asia/Dacca BDT BDT +06:00:00 +00:00:00 +00:00:00
Asia/Damascus EET EET EEST EEST +02:00:00 +01:00:00 -1;5;3 +00:00:00 -1;5;10 +00:00:00
202 Asia/Dhaka BDT BDT +06:00:00 +00:00:00 +00:00:00
203 Asia/Dili TLT TPT TLT TPT +09:00:00 +00:00:00 +00:00:00
204 Asia/Dubai GST GST +04:00:00 +00:00:00 +00:00:00
205 Asia/Dushanbe TJT TJT +05:00:00 +00:00:00 +00:00:00
206 Asia/Gaza EET EET EEST EEST +02:00:00 +01:00:00 -1;6;3 3;5;4 +01:00:00 +00:00:00 3;5;10 +00:00:00
207 Asia/Harbin CST CST +08:00:00 +00:00:00 +00:00:00
Asia/Hebron EET EET EEST EEST +02:00:00 +01:00:00 -1;6;3 +01:00:00 3;5;10 +00:00:00
208 Asia/Hong_Kong HKT HKT +08:00:00 +00:00:00 +00:00:00
209 Asia/Hovd HOVT HOVT HOVST HOVST +07:00:00 +01:00:00 +00:00:00 -1;6;3 +02:00:00 -1;6;9 +00:00:00
210 Asia/Ho_Chi_Minh Asia/Irkutsk ICT IRKT ICT IRKT IRKST IRKST +07:00:00 +08:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
Asia/Irkutsk IRKT IRKT +08:00:00 +00:00:00 +00:00:00
211 Asia/Istanbul EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
212 Asia/Jakarta WIB WIT WIB WIT +07:00:00 +00:00:00 +00:00:00
213 Asia/Jayapura WIT EIT WIT EIT +09:00:00 +00:00:00 +00:00:00
214 Asia/Jerusalem IST IST IDT IDT +02:00:00 +01:00:00 -1;5;3 1;0;4 +02:00:00 +01:00:00 -1;0;10 1;0;10 +02:00:00 +01:00:00
215 Asia/Kabul AFT AFT +04:30:00 +00:00:00 +00:00:00
216 Asia/Kamchatka PETT PETT PETST PETST +12:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
217 Asia/Karachi PKT PKT +05:00:00 +00:00:00 +00:00:00
218 Asia/Kashgar XJT CST XJT CST +06:00:00 +08:00:00 +00:00:00 +00:00:00
Asia/Kathmandu NPT NPT +05:45:00 +00:00:00 +00:00:00
219 Asia/Katmandu NPT NPT +05:45:00 +00:00:00 +00:00:00
220 Asia/Khandyga Asia/Krasnoyarsk YAKT KRAT YAKT KRAT KRAST KRAST +09:00:00 +07:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
Asia/Kolkata IST IST +05:30:00 +00:00:00 +00:00:00
Asia/Krasnoyarsk KRAT KRAT +07:00:00 +00:00:00 +00:00:00
221 Asia/Kuala_Lumpur MYT MYT +08:00:00 +00:00:00 +00:00:00
222 Asia/Kuching MYT MYT +08:00:00 +00:00:00 +00:00:00
223 Asia/Kuwait AST AST +03:00:00 +00:00:00 +00:00:00
224 Asia/Macao CST CST +08:00:00 +00:00:00 +00:00:00
225 Asia/Macau CST CST +08:00:00 +00:00:00 +00:00:00
226 Asia/Magadan MAGT MAGT MAGST MAGST +10:00:00 +11:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
227 Asia/Makassar WITA CIT WITA CIT +08:00:00 +00:00:00 +00:00:00
228 Asia/Manila PHT PHT +08:00:00 +00:00:00 +00:00:00
229 Asia/Muscat GST GST +04:00:00 +00:00:00 +00:00:00
230 Asia/Nicosia EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
231 Asia/Novokuznetsk Asia/Novosibirsk KRAT NOVT KRAT NOVT NOVST NOVST +07:00:00 +06:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
232 Asia/Novosibirsk Asia/Omsk NOVT OMST NOVT OMST OMSST OMSST +06:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
233 Asia/Omsk Asia/Oral OMST WST OMST WST +06:00:00 +05:00:00 +00:00:00 +00:00:00
Asia/Oral ORAT ORAT +05:00:00 +00:00:00 +00:00:00
234 Asia/Phnom_Penh ICT ICT +07:00:00 +00:00:00 +00:00:00
235 Asia/Pontianak WIB WIT WIB WIT +07:00:00 +00:00:00 +00:00:00
236 Asia/Pyongyang KST KST +08:30:00 +09:00:00 +00:00:00 +00:00:00
237 Asia/Qyzylorda KST KST +06:00:00 +00:00:00 +00:00:00
238 Asia/Qatar AST AST +03:00:00 +00:00:00 +00:00:00
Asia/Qyzylorda QYZT QYZT +06:00:00 +00:00:00 +00:00:00
239 Asia/Rangoon MMT MMT +06:30:00 +00:00:00 +00:00:00
240 Asia/Riyadh AST AST +03:00:00 +00:00:00 +00:00:00
241 Asia/Saigon ICT ICT +07:00:00 +00:00:00 +00:00:00
242 Asia/Sakhalin SAKT SAKT SAKST SAKST +11:00:00 +10:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
243 Asia/Samarkand UZT UZT +05:00:00 +00:00:00 +00:00:00
244 Asia/Seoul KST KST +09:00:00 +00:00:00 +00:00:00
245 Asia/Shanghai CST CST +08:00:00 +00:00:00 +00:00:00
246 Asia/Singapore SGT SGT +08:00:00 +00:00:00 +00:00:00
Asia/Srednekolymsk SRET SRET +11:00:00 +00:00:00 +00:00:00
247 Asia/Taipei CST CST +08:00:00 +00:00:00 +00:00:00
248 Asia/Tashkent UZT UZT +05:00:00 +00:00:00 +00:00:00
249 Asia/Tbilisi GET GET GEST GEST +04:00:00 +00:00:00 +01:00:00 -1;0;3 +00:00:00 -1;0;10 +00:00:00
250 Asia/Tehran IRST IRT IRST IRT IRDT IRDT +03:30:00 +01:00:00 +00:00:00 3;1;3 +00:00:00 3;3;9 +00:00:00
Asia/Tel_Aviv IST IST IDT IDT +02:00:00 +01:00:00 -1;5;3 +02:00:00 -1;0;10 +02:00:00
Asia/Thimbu BTT BTT +06:00:00 +00:00:00 +00:00:00
251 Asia/Thimphu BTT BTT +06:00:00 +00:00:00 +00:00:00
252 Asia/Tokyo JST JST +09:00:00 +00:00:00 +00:00:00
253 Asia/Ujung_Pandang WITA CIT WITA CIT +08:00:00 +00:00:00 +00:00:00
254 Asia/Ulaanbaatar ULAT ULAT ULAST ULAST +08:00:00 +01:00:00 +00:00:00 -1;6;3 +02:00:00 -1;6;9 +00:00:00
255 Asia/Ulan_Bator Asia/Urumqi ULAT CST ULAT CST ULAST ULAST +08:00:00 +01:00:00 +00:00:00 -1;6;3 +02:00:00 -1;6;9 +00:00:00
Asia/Urumqi XJT XJT +06:00:00 +00:00:00 +00:00:00
Asia/Ust-Nera VLAT VLAT +10:00:00 +00:00:00 +00:00:00
Asia/Ust_Nera VLAT VLAT +10:00:00 +00:00:00 +00:00:00
256 Asia/Vientiane ICT ICT +07:00:00 +00:00:00 +00:00:00
257 Asia/Vladivostok VLAT VLAT VLAST VLAST +10:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
258 Asia/Yakutsk YAKT YAKT YAKST YAKST +09:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
259 Asia/Yekaterinburg YEKT YEKT YEKST YEKST +05:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
260 Asia/Yerevan AMT AMT AMST AMST +04:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
261 Atlantic/Azores AZOT AZOT AZOST AZOST -01:00:00 +01:00:00 -1;0;3 +00:00:00 -1;0;10 +01:00:00
262 Atlantic/Bermuda AST AST ADT ADT -04:00:00 +01:00:00 2;0;3 1;0;4 +02:00:00 1;0;11 -1;0;10 +02:00:00
263 Atlantic/Canary WET WET WEST WEST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
264 Atlantic/Cape_Verde CVT CVT -01:00:00 +00:00:00 +00:00:00
265 Atlantic/Faeroe WET WET WEST WEST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
Atlantic/Faroe WET WET WEST WEST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
266 Atlantic/Jan_Mayen CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
267 Atlantic/Madeira WET WET WEST WEST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
268 Atlantic/Reykjavik GMT GMT +00:00:00 +00:00:00 +00:00:00
269 Atlantic/South_Georgia GST GST -02:00:00 +00:00:00 +00:00:00
Atlantic/Stanley FKST FKST -03:00:00 +00:00:00 +00:00:00
270 Atlantic/St_Helena GMT GMT +00:00:00 +00:00:00 +00:00:00
271 Australia/ACT Atlantic/Stanley AEST FKT AEST FKT AEDT FKST AEDT FKST +10:00:00 -04:00:00 +01:00:00 1;0;10 1;0;9 +02:00:00 1;0;4 3;0;4 +03:00:00 +02:00:00
272 Australia/Adelaide ACST CST ACST CST ACDT CST ACDT CST +09:30:00 +01:00:00 1;0;10 -1;0;10 +02:00:00 1;0;4 -1;0;3 +03:00:00
273 Australia/Brisbane AEST EST AEST EST +10:00:00 +00:00:00 +00:00:00
274 Australia/Broken_Hill ACST CST ACST CST ACDT CST ACDT CST +09:30:00 +01:00:00 1;0;10 -1;0;10 +02:00:00 1;0;4 -1;0;3 +03:00:00
275 Australia/Canberra Australia/Darwin AEST CST AEST CST AEDT AEDT +10:00:00 +09:30:00 +01:00:00 +00:00:00 1;0;10 +02:00:00 1;0;4 +03:00:00 +00:00:00
276 Australia/Currie Australia/Hobart AEST EST AEST EST AEDT EST AEDT EST +10:00:00 +01:00:00 1;0;10 +02:00:00 1;0;4 -1;0;3 +03:00:00
277 Australia/Darwin Australia/Lindeman ACST EST ACST EST +09:30:00 +10:00:00 +00:00:00 +00:00:00
278 Australia/Eucla Australia/Lord_Howe ACWST LHST ACWST LHST LHST LHST +08:45:00 +10:30:00 +00:00:00 +00:30:00 -1;0;10 +02:00:00 -1;0;3 +00:00:00 +02:00:00
279 Australia/Hobart Australia/Melbourne AEST EST AEST EST AEDT EST AEDT EST +10:00:00 +01:00:00 1;0;10 -1;0;10 +02:00:00 1;0;4 -1;0;3 +03:00:00
280 Australia/LHI Australia/Perth LHST WST LHST WST LHDT LHDT +10:30:00 +08:00:00 +00:30:00 +00:00:00 1;0;10 +02:00:00 1;0;4 +02:00:00 +00:00:00
281 Australia/Lindeman Australia/Sydney AEST EST AEST EST EST EST +10:00:00 +00:00:00 +01:00:00 -1;0;10 +02:00:00 -1;0;3 +00:00:00 +03:00:00
Australia/Lord_Howe LHST LHST LHDT LHDT +10:30:00 +00:30:00 1;0;10 +02:00:00 1;0;4 +02:00:00
Australia/Melbourne AEST AEST AEDT AEDT +10:00:00 +01:00:00 1;0;10 +02:00:00 1;0;4 +03:00:00
Australia/North ACST ACST +09:30:00 +00:00:00 +00:00:00
Australia/NSW AEST AEST AEDT AEDT +10:00:00 +01:00:00 1;0;10 +02:00:00 1;0;4 +03:00:00
Australia/Perth AWST AWST +08:00:00 +00:00:00 +00:00:00
Australia/Queensland AEST AEST +10:00:00 +00:00:00 +00:00:00
Australia/South ACST ACST ACDT ACDT +09:30:00 +01:00:00 1;0;10 +02:00:00 1;0;4 +03:00:00
Australia/Sydney AEST AEST AEDT AEDT +10:00:00 +01:00:00 1;0;10 +02:00:00 1;0;4 +03:00:00
Australia/Tasmania AEST AEST AEDT AEDT +10:00:00 +01:00:00 1;0;10 +02:00:00 1;0;4 +03:00:00
Australia/Victoria AEST AEST AEDT AEDT +10:00:00 +01:00:00 1;0;10 +02:00:00 1;0;4 +03:00:00
Australia/West AWST AWST +08:00:00 +00:00:00 +00:00:00
Australia/Yancowinna ACST ACST ACDT ACDT +09:30:00 +01:00:00 1;0;10 +02:00:00 1;0;4 +03:00:00
Brazil/Acre ACT ACT -05:00:00 +00:00:00 +00:00:00
Brazil/DeNoronha FNT FNT -02:00:00 +00:00:00 +00:00:00
Brazil/East BRT BRT BRST BRST -03:00:00 +01:00:00 3;0;10 +00:00:00 3;0;2 +00:00:00
Brazil/West AMT AMT -04:00:00 +00:00:00 +00:00:00
Canada/Atlantic AST AST ADT ADT -04:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
Canada/Central CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
Canada/East-Saskatchewan CST CST -06:00:00 +00:00:00 +00:00:00
Canada/Eastern EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
Canada/East_Saskatchewan CST CST -06:00:00 +00:00:00 +00:00:00
Canada/Mountain MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
Canada/Newfoundland NST NST NDT NDT -03:30:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
Canada/Pacific PST PST PDT PDT -08:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
Canada/Saskatchewan CST CST -06:00:00 +00:00:00 +00:00:00
Canada/Yukon PST PST PDT PDT -08:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
Chile/Continental CLT CLT CLST CLST -04:00:00 +01:00:00 2;0;8 +00:00:00 3;0;5 +00:00:00
Chile/EasterIsland EAST EAST EASST EASST -06:00:00 +01:00:00 2;6;8 +22:00:00 2;6;5 +22:00:00
Etc/GMT GMT GMT +00:00:00 +00:00:00 +00:00:00
Etc/Greenwich GMT GMT +00:00:00 +00:00:00 +00:00:00
Etc/UCT UCT UCT +00:00:00 +00:00:00 +00:00:00
Etc/Universal UTC UTC +00:00:00 +00:00:00 +00:00:00
Etc/UTC UTC UTC +00:00:00 +00:00:00 +00:00:00
Etc/Zulu UTC UTC +00:00:00 +00:00:00 +00:00:00
282 Europe/Amsterdam CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
283 Europe/Andorra CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
284 Europe/Athens EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
289 Europe/Brussels CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
290 Europe/Bucharest EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
291 Europe/Budapest CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
292 Europe/Busingen Europe/Chisinau CET EET CET EET CEST EEST CEST EEST +01:00:00 +02:00:00 +01:00:00 -1;0;3 +02:00:00 +03:00:00 -1;0;10 +03:00:00 +04:00:00
Europe/Chisinau EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
293 Europe/Copenhagen CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
294 Europe/Dublin GMT GMT IST IST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
295 Europe/Gibraltar CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
Europe/Guernsey GMT GMT BST BST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
296 Europe/Helsinki EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
Europe/Isle_of_Man GMT GMT BST BST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
297 Europe/Istanbul EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
298 Europe/Jersey Europe/Kaliningrad GMT EET GMT EET BST EEST BST EEST +00:00:00 +02:00:00 +01:00:00 -1;0;3 +01:00:00 +02:00:00 -1;0;10 +02:00:00 +03:00:00
Europe/Kaliningrad EET EET +02:00:00 +00:00:00 +00:00:00
299 Europe/Kiev EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
300 Europe/Lisbon WET WET WEST WEST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
301 Europe/Ljubljana CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
303 Europe/Luxembourg CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
304 Europe/Madrid CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
305 Europe/Malta CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
306 Europe/Mariehamn Europe/Minsk EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 +02:00:00 -1;0;10 +04:00:00 +03:00:00
Europe/Minsk MSK MSK +03:00:00 +00:00:00 +00:00:00
307 Europe/Monaco CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
308 Europe/Moscow MSK MSK MSD MSD +03:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
309 Europe/Nicosia EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
310 Europe/Oslo CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
311 Europe/Paris CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
Europe/Podgorica CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
312 Europe/Prague CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
313 Europe/Riga EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
314 Europe/Rome CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
315 Europe/Samara SAMT SAMT SAMST SAMST +04:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
316 Europe/San_Marino CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
317 Europe/Sarajevo CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
318 Europe/Simferopol MSK EET MSK EET EEST EEST +03:00:00 +02:00:00 +00:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +00:00:00 +04:00:00
319 Europe/Skopje CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
320 Europe/Sofia EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
321 Europe/Stockholm CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
322 Europe/Tallinn EET EET EEST EEST +02:00:00 +01:00:00 +00:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00 +00:00:00
323 Europe/Tirane CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
Europe/Tiraspol EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
324 Europe/Uzhgorod EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
325 Europe/Vaduz CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
326 Europe/Vatican CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
327 Europe/Vienna CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
328 Europe/Vilnius EET EET EEST EEST +02:00:00 +01:00:00 +00:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00 +00:00:00
Europe/Volgograd MSK MSK +03:00:00 +00:00:00 +00:00:00
329 Europe/Warsaw CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
330 Europe/Zagreb CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
331 Europe/Zaporozhye EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
341 Indian/Mauritius MUT MUT +04:00:00 +00:00:00 +00:00:00
342 Indian/Mayotte EAT EAT +03:00:00 +00:00:00 +00:00:00
343 Indian/Reunion RET RET +04:00:00 +00:00:00 +00:00:00
344 Mexico/BajaNorte Pacific/Apia PST WST PST WST PDT PDT -08:00:00 -11:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
345 Mexico/BajaSur Pacific/Auckland MST NZST MST NZST MDT NZDT MDT NZDT -07:00:00 +12:00:00 +01:00:00 1;0;4 1;0;10 +02:00:00 -1;0;10 3;0;3 +02:00:00 +03:00:00
346 Mexico/General Pacific/Chatham CST CHAST CST CHAST CDT CHADT CDT CHADT -06:00:00 +12:45:00 +01:00:00 1;0;4 1;0;10 +02:00:00 +02:45:00 -1;0;10 3;0;3 +02:00:00 +03:45:00
347 Pacific/Apia Pacific/Easter WSST EAST WSST EAST WSDT EASST WSDT EASST +13:00:00 -06:00:00 +01:00:00 -1;0;9 2;6;10 +03:00:00 +22:00:00 1;0;4 2;6;3 +04:00:00 +22:00:00
Pacific/Auckland NZST NZST NZDT NZDT +12:00:00 +01:00:00 -1;0;9 +02:00:00 1;0;4 +03:00:00
Pacific/Chatham CHAST CHAST CHADT CHADT +12:45:00 +01:00:00 -1;0;9 +02:00:00 1;0;4 +03:00:00
Pacific/Chuuk CHUT CHUT +10:00:00 +00:00:00 +00:00:00
Pacific/Easter EAST EAST EASST EASST -06:00:00 +01:00:00 2;6;8 +22:00:00 2;6;5 +22:00:00
348 Pacific/Efate VUT VUT +11:00:00 +00:00:00 +00:00:00
349 Pacific/Enderbury PHOT PHOT +13:00:00 +00:00:00 +00:00:00
350 Pacific/Fakaofo TKT TKT +13:00:00 -10:00:00 +00:00:00 +00:00:00
351 Pacific/Fiji FJT FJT FJST FJST +12:00:00 +01:00:00 +00:00:00 1;0;11 +02:00:00 3;0;1 +03:00:00 +00:00:00
352 Pacific/Funafuti TVT TVT +12:00:00 +00:00:00 +00:00:00
353 Pacific/Galapagos GALT GALT -06:00:00 +00:00:00 +00:00:00
354 Pacific/Gambier GAMT GAMT -09:00:00 +00:00:00 +00:00:00
364 Pacific/Midway SST SST -11:00:00 +00:00:00 +00:00:00
365 Pacific/Nauru NRT NRT +12:00:00 +00:00:00 +00:00:00
366 Pacific/Niue NUT NUT -11:00:00 +00:00:00 +00:00:00
367 Pacific/Norfolk NFT NFT +11:00:00 +11:30:00 +00:00:00 +00:00:00
368 Pacific/Noumea NCT NCT +11:00:00 +00:00:00 +00:00:00
369 Pacific/Pago_Pago SST SST -11:00:00 +00:00:00 +00:00:00
370 Pacific/Palau PWT PWT +09:00:00 +00:00:00 +00:00:00
371 Pacific/Pitcairn PST PST -08:00:00 +00:00:00 +00:00:00
Pacific/Pohnpei PONT PONT +11:00:00 +00:00:00 +00:00:00
372 Pacific/Ponape PONT PONT +11:00:00 +00:00:00 +00:00:00
373 Pacific/Port_Moresby PGT PGT +10:00:00 +00:00:00 +00:00:00
374 Pacific/Rarotonga CKT CKT -10:00:00 +00:00:00 +00:00:00
375 Pacific/Saipan ChST ChST +10:00:00 +00:00:00 +00:00:00
Pacific/Samoa SST SST -11:00:00 +00:00:00 +00:00:00
376 Pacific/Tahiti TAHT TAHT -10:00:00 +00:00:00 +00:00:00
377 Pacific/Tarawa GILT GILT +12:00:00 +00:00:00 +00:00:00
378 Pacific/Tongatapu TOT TOT +13:00:00 +00:00:00 +00:00:00
379 Pacific/Truk CHUT TRUT CHUT TRUT +10:00:00 +00:00:00 +00:00:00
380 Pacific/Wake WAKT WAKT +12:00:00 +00:00:00 +00:00:00
381 Pacific/Wallis WFT WFT +12:00:00 +00:00:00 +00:00:00
382 Pacific/Yap CHUT YAPT CHUT YAPT +10:00:00 +00:00:00 +00:00:00
-18
View File
@@ -1,18 +0,0 @@
# Copyright (c) 2016 Rene Rivera
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.2 ;
###############################################################################
alias boostdoc
: ../xmldoc/date_time.xml
:
: <dependency>../xmldoc//date_time_autodoc <dependency>../xmldoc//gregorian_autodoc
<dependency>../xmldoc//posix_time_autodoc <dependency>../xmldoc//local_time_autodoc
: ;
explicit boostdoc ;
alias boostrelease ;
explicit boostrelease ;
+94 -32
View File
@@ -1,47 +1,109 @@
project : requirements <library>/boost/date_time//boost_date_time ;
subproject libs/date_time/example ;
exe dates_as_strings : gregorian/dates_as_strings.cpp ;
exe days_alive : gregorian/days_alive.cpp ;
exe days_till_new_year : gregorian/days_till_new_year.cpp ;
exe days_between_new_years : gregorian/days_between_new_years.cpp ;
exe find_last_day_of_months : gregorian/find_last_day_of_months.cpp ;
exe month_add : gregorian/month_add.cpp ;
exe localization : gregorian/localization.cpp ;
exe print_holidays : gregorian/print_holidays.cpp ;
exe print_month : gregorian/print_month.cpp ;
exe period_calc : gregorian/period_calc.cpp ;
exe days_since_year_start : gregorian/days_since_year_start.cpp ;
local DATE_TIME_PROPERTIES = <define>BOOST_DATE_TIME_STATIC_LINK ;
exe local_utc_conversion : posix_time/local_utc_conversion.cpp
: <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
exe dates_as_strings : <lib>../build/boost_date_time
gregorian/dates_as_strings.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe days_alive : <lib>../build/boost_date_time
gregorian/days_alive.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe print_hours : posix_time/print_hours.cpp
: <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
exe days_till_new_year : <lib>../build/boost_date_time
gregorian/days_till_new_year.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe time_math : posix_time/time_math.cpp
: <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
exe days_between_new_years : <lib>../build/boost_date_time
gregorian/days_between_new_years.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe time_periods : posix_time/time_periods.cpp
: <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe find_last_day_of_months : <lib>../build/boost_date_time
gregorian/find_last_day_of_months.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe simple_time_zone : local_time/simple_time_zone.cpp ;
exe calc_rules : local_time/calc_rules.cpp ;
exe seconds_since_epoch : local_time/seconds_since_epoch.cpp ;
exe flight : local_time/flight.cpp ;
exe io_tutorial : tutorial/io_tutorial.cpp ;
exe month_add : <lib>../build/boost_date_time
gregorian/month_add.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe localization : gregorian/localization.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe print_holidays : <lib>../build/boost_date_time
gregorian/print_holidays.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe print_month : <lib>../build/boost_date_time
gregorian/print_month.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe period_calc : <lib>../build/boost_date_time
gregorian/period_calc.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe days_since_year_start : <lib>../build/boost_date_time
gregorian/days_since_year_start.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe local_utc_conversion : <lib>../build/boost_date_time
posix_time/local_utc_conversion.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES) <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe print_hours : <lib>../build/boost_date_time
posix_time/print_hours.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES) <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe time_math : <lib>../build/boost_date_time
posix_time/time_math.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES) <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe time_periods : <lib>../build/boost_date_time
posix_time/time_periods.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES) <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe simple_time_zone : <lib>../build/boost_date_time
local_time/simple_time_zone.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe calc_rules : <lib>../build/boost_date_time
local_time/calc_rules.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe seconds_since_epoch : <lib>../build/boost_date_time
local_time/seconds_since_epoch.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe flight : <lib>../build/boost_date_time
local_time/flight.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe io_tutorial : tutorial/io_tutorial.cpp
: <include>$(BOOST_ROOT)
;
# Copyright (c) 2002-2005
# CrystalClear Software, Inc.
# Subject to the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or
# 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)
+1 -1
View File
@@ -25,7 +25,7 @@ main()
date d(from_simple_string(s));
std::cout << to_simple_string(d) << std::endl;
//Read ISO 8601 Standard(CCYYMMDD) and output ISO 8601 Extended
//Read ISO Standard(CCYYMMDD) and output ISO Extended
std::string ud("20011009"); //2001-Oct-09
date d1(from_undelimited_string(ud));
std::cout << to_iso_extended_string(d1) << std::endl;
+3 -4
View File
@@ -3,11 +3,10 @@
* New Years day of this year, and days until next New Years day.
*
* Expected results:
* Adding together both durations will produce 365 (366 in a leap year).
* Adding together both durations will produce 366 (365 in a leap year).
*/
#include "boost/date_time/gregorian/gregorian.hpp"
#include <iostream>
#include "boost/date_time/gregorian/gregorian.hpp"
int
main()
@@ -26,7 +25,7 @@ main()
std::cout << "Days until next Jan 1: " << days_until_year_start.days()
<< std::endl;
return 0;
}
};
/* Copyright 2001-2004: CrystalClear Software, Inc
+2 -2
View File
@@ -1,6 +1,6 @@
#include "boost/date_time/gregorian/gregorian.hpp"
#include <iostream>
#include "boost/date_time/gregorian/gregorian.hpp"
int
main()
@@ -14,7 +14,7 @@ main()
std::cout << "Days since Jan 1: " << days_since_year_start.days()
<< std::endl;
return 0;
}
};
/* Copyright 2001-2004: CrystalClear Software, Inc
* http://www.crystalclearsoftware.com
+1 -1
View File
@@ -15,7 +15,7 @@ main()
std::cout << "Days till new year: " << dd.days() << std::endl;
return 0;
}
};
/* Copyright 2001-2004: CrystalClear Software, Inc
* http://www.crystalclearsoftware.com
@@ -15,8 +15,7 @@ main()
// get a month and a year from the user
try {
greg_year::value_type y;
greg_month::value_type m;
int y, m;
std::cout << " Enter Year(ex: 2002): ";
std::cin >> y;
year = greg_year(y);
@@ -24,11 +23,11 @@ main()
std::cin >> m;
month = greg_month(m);
}
catch(const bad_year& by) {
catch(bad_year by) {
std::cout << "Invalid Year Entered: " << by.what() << '\n'
<< "Using minimum values for month and year." << std::endl;
}
catch(const bad_month& bm) {
catch(bad_month bm) {
std::cout << "Invalid Month Entered" << bm.what() << '\n'
<< "Using minimum value for month. " << std::endl;
}
+1 -1
View File
@@ -83,7 +83,7 @@ int main()
us_facet->format("%m/%d/%Y");
std::cout << d1 << std::endl; // 10/01/2002
// English names, ISO 8601 order (year-month-day), '-' separator
// English names, iso order (year-month-day), '-' separator
us_facet->format("%Y-%b-%d");
std::cout << d1 << std::endl; // 2002-Oct-01
+5 -11
View File
@@ -17,7 +17,7 @@ main()
date d2 = d + months(1);
date d3 = d - months(1);
std::cout << "Today is: " << to_simple_string(d) << ".\n"
<< "One month from today will be: " << to_simple_string(d2) << ".\n"
<< "One month from today will be: " << to_simple_string(d2)
<< "One month ago was: " << to_simple_string(d3)
<< std::endl;
std::cout << "******** Warning read this ***********************\n";
@@ -31,20 +31,14 @@ main()
<< std::endl;
std::cout << "\nSo what does this mean? It means the result of adding months is order\n"
<< "dependent, non-commutative, and may create problems for applications.\n"
<< "dependent, non-communitive, and may create problems for applications.\n"
<< "Consider: \n"
<< "Jan 30, 2004 + (1 month) + (1 month) != Jan 30, 2004 + (2 months)\n"
<< "Why not? Because Jan 30, 2004 + 1 month is Feb 29 + 1 month is Mar 31st.\n"
<< "while Jan 30, 2004 + 2 months is Mar 30th.\n"
<< "Jan 30, 2004 + (1 month) + (1 month) != Jan 29, 2004 + (2 months)\n"
<< "Why not? Because Jan 30, 2004 + 1 month is Feb 29 + 1 month is Mar 29th.\n"
<< "while Jan 30, 2004 + 2 months is Mar 29th.\n"
<< "All of this clears up as long as all the starting dates before the 28th of\n"
<< "the month -- then all the behavior follows classical mathematical rules.\n";
date d6(2004, Jan, 30);
date d7 = d6 + months(1) + months(1);
date d8 = d6 + months(2);
std::cout << "2004-01-30 + (1 month) + (1 month) is: " << to_simple_string(d7) << ".\n"
<< "2004-01-30 + (2 months) is: " << to_simple_string(d8)
<< std::endl;
return 0;
}
+3 -3
View File
@@ -33,12 +33,12 @@ print_date(boost::gregorian::date d)
int
main() {
using namespace boost::gregorian;
std::cout << "Enter Year: ";
greg_year::value_type year;
int year;
std::cin >> year;
using namespace boost::gregorian;
//define a collection of holidays fixed by month and day
std::vector<year_based_generator*> holidays;
holidays.push_back(new partial_date(1,Jan)); //Western New Year
+3 -5
View File
@@ -19,18 +19,16 @@
int
main()
{
using namespace boost::gregorian;
std::cout << "Enter Year: ";
greg_year::value_type year;
greg_month::value_type month;
int year, month;
std::cin >> year;
std::cout << "Enter Month(1..12): ";
std::cin >> month;
using namespace boost::gregorian;
try {
//Use the calendar to get the last day of the month
greg_day::value_type eom_day = gregorian_calendar::end_of_month_day(year,month);
int eom_day = gregorian_calendar::end_of_month_day(year,month);
date endOfMonth(year,month,eom_day);
//construct an iterator starting with firt day of the month
+9 -19
View File
@@ -5,7 +5,7 @@
/* This example shows a program that calculates the arrival time of a plane
* that flys from Phoenix to New York. During the flight New York shifts
* into daylight savings time (Phoenix doesn't because Arizona doesn't use
* DST).
* dst).
*
*
*/
@@ -20,34 +20,24 @@ int main()
//setup some timezones for creating and adjusting local times
//This user editable file can be found in libs/date_time/data.
tz_database tz_db;
try {
tz_db.load_from_file("../../data/date_time_zonespec.csv");
}catch(const data_not_accessible& dna) {
std::cerr << "Error with time zone data file: " << dna.what() << std::endl;
exit(EXIT_FAILURE);
}catch(const bad_field_count& bfc) {
std::cerr << "Error with time zone data file: " << bfc.what() << std::endl;
exit(EXIT_FAILURE);
}
tz_db.load_from_file("date_time_zonespec.csv");
time_zone_ptr nyc_tz = tz_db.time_zone_from_region("America/New_York");
//Use a newly created time zone rule
//Use a
time_zone_ptr phx_tz(new posix_time_zone("MST-07:00:00"));
//local departure time in Phoenix is 11 pm on March 13 2010
// (NY changes to DST on March 14 at 2 am)
local_date_time phx_departure(date(2010, Mar, 13), hours(23),
//local departure time in phoenix is 11 pm on april 2 2005
// (ny changes to dst on apr 3 at 2 am)
local_date_time phx_departure(date(2005, Apr, 2), hours(23),
phx_tz,
local_date_time::NOT_DATE_TIME_ON_ERROR);
local_date_time nyc_departure = phx_departure.local_time_in(nyc_tz);
time_duration flight_length = hours(4) + minutes(30);
local_date_time phx_arrival = phx_departure + flight_length;
local_date_time nyc_arrival = phx_arrival.local_time_in(nyc_tz);
std::cout << "departure PHX time: " << phx_departure << std::endl;
std::cout << "departure NYC time: " << nyc_departure << std::endl;
std::cout << "arrival PHX time: " << phx_arrival << std::endl;
std::cout << "arrival NYC time: " << nyc_arrival << std::endl;
std::cout << "departure phx time: " << phx_departure << std::endl;
std::cout << "arrival phx time: " << phx_arrival << std::endl;
std::cout << "arrival nyc time: " << nyc_arrival << std::endl;
}
+3 -3
View File
@@ -24,14 +24,14 @@ int main() {
local_date_time ny_time(date(2004, Aug, 30), hours(10), nyc, true);
typedef boost::date_time::time_facet<local_date_time, char> ldt_facet;
ldt_facet* timefacet = new ldt_facet("%Y-%b-%d %H:%M:%S""%F %Z");
ldt_facet* timefacet = new ldt_facet("%Y-%b-%d %H:%M:%S%F %Z");
std::locale loc(std::locale::classic(), timefacet);
std::cout << ny_time << std::endl;
// 2004-Aug-30 10:00:00 EDT
// 2004-Aug-30 00:00:00 EDT
std::cout.imbue(loc);
std::cout << ny_time << std::endl;
// 2004-Aug-30 10:00:00 Eastern Daylight Time
// 2004-Aug-30 00:00:00 Eastern Daylight Time
return 0;
}
+2 -2
View File
@@ -24,10 +24,10 @@ int main()
tz_database tz_db;
try {
tz_db.load_from_file("../data/date_time_zonespec.csv");
}catch(const data_not_accessible& dna) {
}catch(data_not_accessible dna) {
std::cerr << "Error with time zone data file: " << dna.what() << std::endl;
exit(EXIT_FAILURE);
}catch(const bad_field_count& bfc) {
}catch(bad_field_count bfc) {
std::cerr << "Error with time zone data file: " << bfc.what() << std::endl;
exit(EXIT_FAILURE);
}
+4 -4
View File
@@ -29,16 +29,16 @@ main()
ptime now = second_clock::local_time();
//Get the date part out of the time
date today = now.date();
date tomorrow = today + days(1);
ptime tomorrow_start(tomorrow); //midnight
date tommorrow = today + days(1);
ptime tommorrow_start(tommorrow); //midnight
//iterator adds by one hour
time_iterator titr(now,hours(1));
for (; titr < tomorrow_start; ++titr) {
for (; titr < tommorrow_start; ++titr) {
std::cout << to_simple_string(*titr) << std::endl;
}
time_duration remaining = tomorrow_start - now;
time_duration remaining = tommorrow_start - now;
std::cout << "Time left till midnight: "
<< to_simple_string(remaining) << std::endl;
return 0;
+1 -1
View File
@@ -13,7 +13,7 @@ main()
using namespace boost::gregorian;
date d(2002,Feb,1); //an arbitrary date
//construct a time by adding up some durations
//construct a time by adding up some durations durations
ptime t1(d, hours(5)+minutes(4)+seconds(2)+milliseconds(1));
//construct a new time by subtracting some times
ptime t2 = t1 - hours(5)- minutes(4)- seconds(2)- milliseconds(1);
+1 -1
View File
@@ -141,7 +141,7 @@ int main(){
period_formatter per_formatter(period_formatter::AS_OPEN_RANGE,
" to ", "from ", " exclusive", " inclusive" );
period_parser per_parser(period_parser::AS_OPEN_RANGE,
" to ", "from ", " exclusive" , " inclusive" );
" to ", "from ", " exclusive" , "inclusive" );
// default output
ss.str("");
+34 -20
View File
@@ -2,7 +2,7 @@
#define _DATE_TIME_ADJUST_FUNCTORS_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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
@@ -14,21 +14,26 @@
namespace boost {
namespace date_time {
//! Functor to iterate a fixed number of days
template<class date_type>
class day_functor
class day_functor
{
public:
typedef typename date_type::duration_type duration_type;
day_functor(int f) : f_(f) {}
duration_type get_offset(const date_type&) const
duration_type get_offset(const date_type& d) const
{
// why is 'd' a parameter???
// fix compiler warnings
d.year();
return duration_type(f_);
}
duration_type get_neg_offset(const date_type&) const
duration_type get_neg_offset(const date_type& d) const
{
// fix compiler warnings
d.year();
return duration_type(-f_);
}
private:
@@ -38,7 +43,7 @@ namespace date_time {
//! Provides calculation to find next nth month given a date
/*! This adjustment function provides the logic for 'month-based'
* advancement on a ymd based calendar. The policy it uses
* advancement on a ymd based calendar. The policy it uses
* to handle the non existant end of month days is to back
* up to the last day of the month. Also, if the starting
* date is the last day of a month, this functor will attempt
@@ -46,7 +51,7 @@ namespace date_time {
*/
template<class date_type>
class month_functor
class month_functor
{
public:
typedef typename date_type::duration_type duration_type;
@@ -55,7 +60,7 @@ namespace date_time {
typedef typename cal_type::day_type day_type;
month_functor(int f) : f_(f), origDayOfMonth_(0) {}
duration_type get_offset(const date_type& d) const
duration_type get_offset(const date_type& d) const
{
ymd_type ymd(d.year_month_day());
if (origDayOfMonth_ == 0) {
@@ -66,9 +71,11 @@ namespace date_time {
}
}
typedef date_time::wrapping_int2<short,1,12> wrap_int2;
typedef typename wrap_int2::int_type int_type;
wrap_int2 wi(ymd.month);
//calc the year wrap around, add() returns 0 or 1 if wrapped
const typename ymd_type::year_type year(static_cast<typename ymd_type::year_type::value_type>(ymd.year + wi.add(f_)));
int_type year = wi.add(static_cast<int_type>(f_));
year = static_cast<int_type>(year + ymd.year); //calculate resulting year
// std::cout << "trace wi: " << wi.as_int() << std::endl;
// std::cout << "trace year: " << year << std::endl;
//find the last day for the new month
@@ -84,7 +91,7 @@ namespace date_time {
return date_type(year, wi.as_int(), dayOfMonth) - d;
}
//! Returns a negative duration_type
duration_type get_neg_offset(const date_type& d) const
duration_type get_neg_offset(const date_type& d) const
{
ymd_type ymd(d.year_month_day());
if (origDayOfMonth_ == 0) {
@@ -95,9 +102,11 @@ namespace date_time {
}
}
typedef date_time::wrapping_int2<short,1,12> wrap_int2;
typedef typename wrap_int2::int_type int_type;
wrap_int2 wi(ymd.month);
//calc the year wrap around, add() returns 0 or 1 if wrapped
const typename ymd_type::year_type year(static_cast<typename ymd_type::year_type::value_type>(ymd.year + wi.subtract(f_)));
int_type year = wi.subtract(static_cast<int_type>(f_));
year = static_cast<int_type>(year + ymd.year); //calculate resulting year
//find the last day for the new month
day_type resultingEndOfMonthDay(cal_type::end_of_month_day(year, wi.as_int()));
//original was the end of month -- force to last day of month
@@ -118,19 +127,24 @@ namespace date_time {
//! Functor to iterate a over weeks
template<class date_type>
class week_functor
class week_functor
{
public:
typedef typename date_type::duration_type duration_type;
typedef typename date_type::calendar_type calendar_type;
week_functor(int f) : f_(f) {}
duration_type get_offset(const date_type&) const
duration_type get_offset(const date_type& d) const
{
return duration_type(f_*static_cast<int>(calendar_type::days_in_week()));
// why is 'd' a parameter???
// fix compiler warnings
d.year();
return duration_type(f_*calendar_type::days_in_week());
}
duration_type get_neg_offset(const date_type&) const
duration_type get_neg_offset(const date_type& d) const
{
return duration_type(-f_*static_cast<int>(calendar_type::days_in_week()));
// fix compiler warnings
d.year();
return duration_type(-f_*calendar_type::days_in_week());
}
private:
int f_;
@@ -138,17 +152,17 @@ namespace date_time {
//! Functor to iterate by a year adjusting for leap years
template<class date_type>
class year_functor
class year_functor
{
public:
//typedef typename date_type::year_type year_type;
typedef typename date_type::duration_type duration_type;
year_functor(int f) : _mf(f * 12) {}
duration_type get_offset(const date_type& d) const
duration_type get_offset(const date_type& d) const
{
return _mf.get_offset(d);
}
duration_type get_neg_offset(const date_type& d) const
duration_type get_neg_offset(const date_type& d) const
{
return _mf.get_neg_offset(d);
}
@@ -156,7 +170,7 @@ namespace date_time {
month_functor<date_type> _mf;
};
} }//namespace date_time
@@ -17,7 +17,6 @@
#include <boost/throw_exception.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/c_time.hpp>
#include <boost/numeric/conversion/cast.hpp>
namespace boost {
namespace date_time {
@@ -43,14 +42,9 @@ namespace date_time {
}
date_duration_type dd = t.date() - time_t_start_day;
time_duration_type td = t.time_of_day();
uint64_t t2 = static_cast<uint64_t>(dd.days())*86400 +
static_cast<uint64_t>(td.hours())*3600 +
static_cast<uint64_t>(td.minutes())*60 +
td.seconds();
// detect y2038 issue and throw instead of proceed with bad time
std::time_t tv = boost::numeric_cast<std::time_t>(t2);
std::time_t t2 = dd.days()*86400 + td.hours()*3600 + td.minutes()*60 + td.seconds();
std::tm tms, *tms_ptr;
tms_ptr = c_time::localtime(&tv, &tms);
tms_ptr = c_time::localtime(&t2, &tms);
date_type d(static_cast<unsigned short>(tms_ptr->tm_year + 1900),
static_cast<unsigned short>(tms_ptr->tm_mon + 1),
static_cast<unsigned short>(tms_ptr->tm_mday));
+6 -27
View File
@@ -57,15 +57,7 @@ namespace date_time {
static std::tm* localtime(const std::time_t* t, std::tm* result)
{
// localtime_r() not in namespace std???
#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
std::tm tmp;
if(!localtime_r(t,&tmp))
result = 0;
else
*result = tmp;
#else
result = localtime_r(t, result);
#endif
if (!result)
boost::throw_exception(std::runtime_error("could not convert calendar time to local time"));
return result;
@@ -75,28 +67,17 @@ namespace date_time {
static std::tm* gmtime(const std::time_t* t, std::tm* result)
{
// gmtime_r() not in namespace std???
#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
std::tm tmp;
if(!gmtime_r(t,&tmp))
result = 0;
else
*result = tmp;
#else
result = gmtime_r(t, result);
#endif
if (!result)
boost::throw_exception(std::runtime_error("could not convert calendar time to UTC time"));
return result;
}
#else // BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
#else // BOOST_HAS_THREADS
#if defined(__clang__) // Clang has to be checked before MSVC
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400))
#if (defined(_MSC_VER) && (_MSC_VER >= 1400))
#pragma warning(push) // preserve warning settings
#pragma warning(disable : 4996) // disable depricated localtime/gmtime warning on vc8
#endif
#endif // _MSC_VER >= 1400
//! requires a pointer to a user created std::tm struct
inline
static std::tm* localtime(const std::time_t* t, std::tm* result)
@@ -115,13 +96,11 @@ namespace date_time {
boost::throw_exception(std::runtime_error("could not convert calendar time to UTC time"));
return result;
}
#if defined(__clang__) // Clang has to be checked before MSVC
#pragma clang diagnostic pop
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400))
#if (defined(_MSC_VER) && (_MSC_VER >= 1400))
#pragma warning(pop) // restore warnings to previous state
#endif
#endif // _MSC_VER >= 1400
#endif // BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
#endif // BOOST_HAS_THREADS
};
}} // namespaces
+55 -21
View File
@@ -12,6 +12,19 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
// With boost release 1.33, date_time will be using a different,
// more flexible, IO system. This new system is not compatible with
// old compilers. The original date_time IO system remains for those
// compilers. They must define this macro to use the legacy IO.
// (defined(__BORLANDC__) && (__BORLANDC__ <= 0x0581) ) ) &&
#if( BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) \
|| BOOST_WORKAROUND( __GNUC__, < 3) \
|| (BOOST_WORKAROUND( _MSC_VER, <= 1300) ) \
) \
&& !defined(USE_DATE_TIME_PRE_1_33_FACET_IO)
# define USE_DATE_TIME_PRE_1_33_FACET_IO
#endif
// This file performs some local compiler configurations
@@ -28,8 +41,12 @@
// Include extensions to date_duration - comment out to remove this feature
#define BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES
// these extensions are known to cause problems with gcc295
#if defined(__GNUC__) && (__GNUC__ < 3)
#undef BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES
#endif
#if (defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) || BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) ) )
#if (defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) || BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) )
#define BOOST_DATE_TIME_NO_MEMBER_INIT
#endif
@@ -43,13 +60,13 @@
/* Workaround for Borland iterator error. Error was "Cannot convert 'istream *' to 'wistream *' in function istream_iterator<>::istream_iterator() */
#if defined(BOOST_BORLANDC) && defined(BOOST_BCB_WITH_RW_LIB)
#if defined(__BORLANDC__) && defined(BOOST_BCB_WITH_RW_LIB)
#define BOOST_DATE_TIME_NO_WISTREAM_ITERATOR
#endif
// Borland v5.64 does not have the following in std namespace; v5.5.1 does
#if defined(BOOST_BORLANDC) && defined(BOOST_BCB_WITH_STLPORT)
#if defined(__BORLANDC__) && defined(BOOST_BCB_WITH_STLPORT)
#include <locale>
namespace std {
using stlport::tolower;
@@ -66,7 +83,7 @@ namespace std {
#if (((defined(__GNUC__) && (__GNUC__ < 3)) || \
(defined(_MSC_VER) && (_MSC_VER < 1300)) ) && \
!defined(_STLP_OWN_IOSTREAMS) ) || \
BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) )
BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) )
#define BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS
#endif
@@ -101,24 +118,46 @@ namespace std {
*
*/
// we need to import/export our code only if the user has specifically
// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
// libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK
// if they want just this one to be dynamically liked:
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK)
// export if this is our own source, otherwise import:
# ifdef BOOST_DATE_TIME_SOURCE
# define BOOST_DATE_TIME_DECL BOOST_SYMBOL_EXPORT
# else
# define BOOST_DATE_TIME_DECL BOOST_SYMBOL_IMPORT
# endif // BOOST_DATE_TIME_SOURCE
#endif // DYN_LINK
#ifdef BOOST_HAS_DECLSPEC // defined in config system
// we need to import/export our code only if the user has specifically
// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
// libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK
// if they want just this one to be dynamically liked:
# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK)
// export if this is our own source, otherwise import:
# ifdef BOOST_DATE_TIME_SOURCE
# define BOOST_DATE_TIME_DECL __declspec(dllexport)
# else
# define BOOST_DATE_TIME_DECL __declspec(dllimport)
# endif // BOOST_DATE_TIME_SOURCE
# endif // DYN_LINK
#endif // BOOST_HAS_DECLSPEC
//
// if BOOST_WHATEVER_DECL isn't defined yet define it now:
#ifndef BOOST_DATE_TIME_DECL
# define BOOST_DATE_TIME_DECL
#endif
//
// Automatically link to the correct build variant where possible.
//
#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_DATE_TIME_NO_LIB) && !defined(BOOST_DATE_TIME_SOURCE)
//
// Set the name of our library, this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define BOOST_LIB_NAME boost_date_time
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK)
# define BOOST_DYN_LINK
#endif
//
// And include the header that does the work:
//
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
#if defined(BOOST_HAS_THREADS)
# if defined(_MSC_VER) || defined(__MWERKS__) || defined(__MINGW32__) || defined(__BORLANDC__)
@@ -128,10 +167,5 @@ namespace std {
# endif
#endif
#if defined(BOOST_NO_CXX11_NULLPTR)
# define BOOST_DATE_TIME_NULLPTR 0
#else
# define BOOST_DATE_TIME_NULLPTR nullptr
#endif
#endif
+14 -22
View File
@@ -13,7 +13,7 @@
#include <stdexcept>
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/type_traits/conditional.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_base_of.hpp>
namespace boost {
@@ -39,33 +39,29 @@ namespace CV {
*
*/
template<class value_policies>
class BOOST_SYMBOL_VISIBLE constrained_value {
class constrained_value {
public:
typedef typename value_policies::value_type value_type;
// typedef except_type exception_type;
BOOST_CXX14_CONSTEXPR constrained_value(value_type value) : value_((min)())
constrained_value(value_type value) : value_((min)())
{
assign(value);
}
BOOST_CXX14_CONSTEXPR constrained_value& operator=(value_type v)
constrained_value& operator=(value_type v)
{
assign(v);
return *this;
}
//! Return the max allowed value (traits method)
static BOOST_CONSTEXPR value_type
max BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::max)();}
static value_type max BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::max)();}
//! Return the min allowed value (traits method)
static BOOST_CONSTEXPR value_type
min BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::min)();}
static value_type min BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::min)();}
//! Coerce into the representation type
BOOST_CXX14_CONSTEXPR operator value_type() const {return value_;}
operator value_type() const {return value_;}
protected:
value_type value_;
private:
BOOST_CXX14_CONSTEXPR void assign(value_type value)
void assign(value_type value)
{
//adding 1 below gets rid of a compiler warning which occurs when the
//min_value is 0 and the type is unsigned....
@@ -84,9 +80,9 @@ namespace CV {
//! Template to shortcut the constrained_value policy creation process
template<typename rep_type, rep_type min_value,
rep_type max_value, class exception_type>
class BOOST_SYMBOL_VISIBLE simple_exception_policy
class simple_exception_policy
{
struct BOOST_SYMBOL_VISIBLE exception_wrapper : public exception_type
struct exception_wrapper : public exception_type
{
// In order to support throw_exception mechanism in the BOOST_NO_EXCEPTIONS mode,
// we'll have to provide a way to acquire std::exception from the exception being thrown.
@@ -99,20 +95,16 @@ namespace CV {
}
};
typedef typename conditional<
is_base_of< std::exception, exception_type >::value,
typedef typename mpl::if_<
is_base_of< std::exception, exception_type >,
exception_type,
exception_wrapper
>::type actual_exception_type;
public:
typedef rep_type value_type;
static BOOST_CONSTEXPR rep_type
min BOOST_PREVENT_MACRO_SUBSTITUTION () { return min_value; }
static BOOST_CONSTEXPR rep_type
max BOOST_PREVENT_MACRO_SUBSTITUTION () { return max_value; }
static rep_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return min_value; }
static rep_type max BOOST_PREVENT_MACRO_SUBSTITUTION () { return max_value; }
static void on_error(rep_type, rep_type, violation_enum)
{
boost::throw_exception(actual_exception_type());
+27 -28
View File
@@ -10,7 +10,6 @@
*/
#include <boost/operators.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/year_month_day.hpp>
#include <boost/date_time/special_defs.hpp>
@@ -21,7 +20,7 @@ namespace date_time {
/*!
The date template represents an interface shell for a date class
that is based on a year-month-day system such as the gregorian
or ISO 8601 systems. It provides basic operations to enable calculation
or iso systems. It provides basic operations to enable calculation
and comparisons.
<b>Theory</b>
@@ -51,7 +50,7 @@ namespace date_time {
template<class T, class calendar, class duration_type_>
class BOOST_SYMBOL_VISIBLE date : private
class date : private
boost::less_than_comparable<T
, boost::equality_comparable<T
> >
@@ -68,76 +67,76 @@ namespace date_time {
typedef typename calendar::date_rep_type date_rep_type;
typedef typename calendar::date_int_type date_int_type;
typedef typename calendar::day_of_week_type day_of_week_type;
BOOST_CXX14_CONSTEXPR date(year_type y, month_type m, day_type d)
date(year_type y, month_type m, day_type d)
: days_(calendar::day_number(ymd_type(y, m, d)))
{}
BOOST_CXX14_CONSTEXPR date(const ymd_type& ymd)
date(const ymd_type& ymd)
: days_(calendar::day_number(ymd))
{}
//let the compiler write copy, assignment, and destructor
BOOST_CXX14_CONSTEXPR year_type year() const
year_type year() const
{
ymd_type ymd = calendar::from_day_number(days_);
return ymd.year;
}
BOOST_CXX14_CONSTEXPR month_type month() const
month_type month() const
{
ymd_type ymd = calendar::from_day_number(days_);
return ymd.month;
}
BOOST_CXX14_CONSTEXPR day_type day() const
day_type day() const
{
ymd_type ymd = calendar::from_day_number(days_);
return ymd.day;
}
BOOST_CXX14_CONSTEXPR day_of_week_type day_of_week() const
day_of_week_type day_of_week() const
{
ymd_type ymd = calendar::from_day_number(days_);
return calendar::day_of_week(ymd);
}
BOOST_CXX14_CONSTEXPR ymd_type year_month_day() const
ymd_type year_month_day() const
{
return calendar::from_day_number(days_);
}
BOOST_CONSTEXPR bool operator<(const date_type& rhs) const
bool operator<(const date_type& rhs) const
{
return days_ < rhs.days_;
}
BOOST_CONSTEXPR bool operator==(const date_type& rhs) const
bool operator==(const date_type& rhs) const
{
return days_ == rhs.days_;
}
//! check to see if date is a special value
BOOST_CONSTEXPR bool is_special()const
bool is_special()const
{
return(is_not_a_date() || is_infinity());
}
//! check to see if date is not a value
BOOST_CONSTEXPR bool is_not_a_date() const
bool is_not_a_date() const
{
return traits_type::is_not_a_number(days_);
}
//! check to see if date is one of the infinity values
BOOST_CONSTEXPR bool is_infinity() const
bool is_infinity() const
{
return traits_type::is_inf(days_);
}
//! check to see if date is greater than all possible dates
BOOST_CONSTEXPR bool is_pos_infinity() const
bool is_pos_infinity() const
{
return traits_type::is_pos_inf(days_);
}
//! check to see if date is greater than all possible dates
BOOST_CONSTEXPR bool is_neg_infinity() const
bool is_neg_infinity() const
{
return traits_type::is_neg_inf(days_);
}
//! return as a special value or a not_special if a normal date
BOOST_CXX14_CONSTEXPR special_values as_special() const
special_values as_special() const
{
return traits_type::to_special(days_);
}
BOOST_CXX14_CONSTEXPR duration_type operator-(const date_type& d) const
duration_type operator-(const date_type& d) const
{
if (!this->is_special() && !d.is_special())
{
@@ -154,33 +153,33 @@ namespace date_time {
}
}
BOOST_CXX14_CONSTEXPR date_type operator-(const duration_type& dd) const
date_type operator-(const duration_type& dd) const
{
if(dd.is_special())
{
return date_type(date_rep_type(days_) - dd.get_rep());
}
return date_type(date_rep_type(days_) - static_cast<date_int_type>(dd.days()));
return date_type(date_rep_type(days_) - dd.days());
}
BOOST_CXX14_CONSTEXPR date_type operator-=(const duration_type& dd)
date_type operator-=(const duration_type& dd)
{
*this = *this - dd;
return date_type(days_);
}
BOOST_CONSTEXPR date_rep_type day_count() const
date_rep_type day_count() const
{
return days_;
}
//allow internal access from operators
BOOST_CXX14_CONSTEXPR date_type operator+(const duration_type& dd) const
date_type operator+(const duration_type& dd) const
{
if(dd.is_special())
{
return date_type(date_rep_type(days_) + dd.get_rep());
}
return date_type(date_rep_type(days_) + static_cast<date_int_type>(dd.days()));
return date_type(date_rep_type(days_) + dd.days());
}
BOOST_CXX14_CONSTEXPR date_type operator+=(const duration_type& dd)
date_type operator+=(const duration_type& dd)
{
*this = *this + dd;
return date_type(days_);
@@ -192,8 +191,8 @@ namespace date_time {
dates. It is not exposed to users since that would require class
users to understand the inner workings of the date class.
*/
BOOST_CONSTEXPR explicit date(date_int_type days) : days_(days) {}
BOOST_CXX14_CONSTEXPR explicit date(date_rep_type days) : days_(days.as_number()) {}
explicit date(date_int_type days) : days_(days) {};
explicit date(date_rep_type days) : days_(days.as_number()) {};
date_int_type days_;
};
@@ -36,18 +36,18 @@ namespace date_time {
{
::std::tm result;
::std::tm* curr = get_local_time(result);
return ymd_type(static_cast<unsigned short>(curr->tm_year + 1900),
static_cast<unsigned short>(curr->tm_mon + 1),
static_cast<unsigned short>(curr->tm_mday));
return ymd_type(curr->tm_year + 1900,
curr->tm_mon + 1,
curr->tm_mday);
}
//! Get the current day in universal date as a ymd_type
static typename date_type::ymd_type universal_day_ymd()
{
::std::tm result;
::std::tm* curr = get_universal_time(result);
return ymd_type(static_cast<unsigned short>(curr->tm_year + 1900),
static_cast<unsigned short>(curr->tm_mon + 1),
static_cast<unsigned short>(curr->tm_mday));
return ymd_type(curr->tm_year + 1900,
curr->tm_mon + 1,
curr->tm_mday);
}
//! Get the UTC day as a date type
static date_type universal_day()
+29 -29
View File
@@ -2,7 +2,7 @@
#define DATE_TIME_DATE_DURATION__
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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
@@ -12,8 +12,6 @@
#include <boost/operators.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/int_adapter.hpp>
namespace boost {
namespace date_time {
@@ -21,57 +19,59 @@ namespace date_time {
//! Duration type with date level resolution
template<class duration_rep_traits>
class BOOST_SYMBOL_VISIBLE date_duration : private
class date_duration : private
boost::less_than_comparable1< date_duration< duration_rep_traits >
, boost::equality_comparable1< date_duration< duration_rep_traits >
, boost::addable1< date_duration< duration_rep_traits >
, boost::subtractable1< date_duration< duration_rep_traits >
, boost::dividable2< date_duration< duration_rep_traits >, int
> > > > >
{
{
public:
typedef typename duration_rep_traits::int_type duration_rep_type;
typedef typename duration_rep_traits::impl_type duration_rep;
//! Construct from a day count
BOOST_CXX14_CONSTEXPR explicit date_duration(duration_rep day_count) : days_(day_count) {}
explicit date_duration(duration_rep day_count) : days_(day_count) {};
/*! construct from special_values - only works when
* instantiated with duration_traits_adapted */
BOOST_CXX14_CONSTEXPR date_duration(special_values sv) :
date_duration(special_values sv) :
days_(duration_rep::from_special(sv))
{}
// copy constructor required for addable<> & subtractable<>
//! Construct from another date_duration (Copy Constructor)
date_duration(const date_duration<duration_rep_traits>& other) :
days_(other.days_)
{}
//! returns days_ as it's instantiated type - used for streaming
BOOST_CXX14_CONSTEXPR duration_rep get_rep()const
duration_rep get_rep()const
{
return days_;
}
BOOST_CXX14_CONSTEXPR special_values as_special() const
{
return days_.as_special();
}
BOOST_CXX14_CONSTEXPR bool is_special()const
bool is_special()const
{
return days_.is_special();
}
//! returns days as value, not object.
BOOST_CXX14_CONSTEXPR duration_rep_type days() const
duration_rep_type days() const
{
return duration_rep_traits::as_number(days_);
}
//! Returns the smallest duration -- used by to calculate 'end'
static BOOST_CXX14_CONSTEXPR date_duration unit()
static date_duration unit()
{
return date_duration<duration_rep_traits>(1);
}
//! Equality
BOOST_CXX14_CONSTEXPR bool operator==(const date_duration& rhs) const
bool operator==(const date_duration& rhs) const
{
return days_ == rhs.days_;
}
//! Less
BOOST_CXX14_CONSTEXPR bool operator<(const date_duration& rhs) const
bool operator<(const date_duration& rhs) const
{
return days_ < rhs.days_;
}
@@ -82,33 +82,33 @@ namespace date_time {
* so this will not compile */
//! Subtract another duration -- result is signed
BOOST_CXX14_CONSTEXPR date_duration& operator-=(const date_duration& rhs)
date_duration& operator-=(const date_duration& rhs)
{
//days_ -= rhs.days_;
days_ = days_ - rhs.days_;
return *this;
}
//! Add a duration -- result is signed
BOOST_CXX14_CONSTEXPR date_duration& operator+=(const date_duration& rhs)
date_duration& operator+=(const date_duration& rhs)
{
days_ = days_ + rhs.days_;
return *this;
}
//! unary- Allows for dd = -date_duration(2); -> dd == -2
BOOST_CXX14_CONSTEXPR date_duration operator-() const
date_duration operator-() const
{
return date_duration<duration_rep_traits>(get_rep() * (-1));
}
//! Division operations on a duration with an integer.
BOOST_CXX14_CONSTEXPR date_duration& operator/=(int divisor)
date_duration& operator/=(int divisor)
{
days_ = days_ / divisor;
return *this;
}
//! return sign information
BOOST_CXX14_CONSTEXPR bool is_negative() const
bool is_negative() const
{
return days_ < 0;
}
@@ -121,23 +121,23 @@ namespace date_time {
/*! Struct for instantiating date_duration with <b>NO</b> special values
* functionality. Allows for transparent implementation of either
* date_duration<long> or date_duration<int_adapter<long> > */
struct BOOST_SYMBOL_VISIBLE duration_traits_long
struct duration_traits_long
{
typedef long int_type;
typedef long impl_type;
static BOOST_CXX14_CONSTEXPR int_type as_number(impl_type i) { return i; }
static int_type as_number(impl_type i) { return i; };
};
/*! Struct for instantiating date_duration <b>WITH</b> special values
* functionality. Allows for transparent implementation of either
* date_duration<long> or date_duration<int_adapter<long> > */
struct BOOST_SYMBOL_VISIBLE duration_traits_adapted
struct duration_traits_adapted
{
typedef long int_type;
typedef boost::date_time::int_adapter<long> impl_type;
static BOOST_CXX14_CONSTEXPR int_type as_number(impl_type i) { return i.as_number(); }
static int_type as_number(impl_type i) { return i.as_number(); };
};
} } //namspace date_time
+54 -50
View File
@@ -8,8 +8,7 @@
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/int_adapter.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/date_duration.hpp>
@@ -20,17 +19,17 @@ namespace date_time {
//! Additional duration type that represents a number of n*7 days
template <class duration_config>
class BOOST_SYMBOL_VISIBLE weeks_duration : public date_duration<duration_config> {
class weeks_duration : public date_duration<duration_config> {
public:
BOOST_CXX14_CONSTEXPR weeks_duration(typename duration_config::impl_type w)
weeks_duration(typename duration_config::impl_type w)
: date_duration<duration_config>(w * 7) {}
BOOST_CXX14_CONSTEXPR weeks_duration(special_values sv)
weeks_duration(special_values sv)
: date_duration<duration_config>(sv) {}
};
// predeclare
template<class t>
class BOOST_SYMBOL_VISIBLE years_duration;
class years_duration;
//! additional duration type that represents a logical month
/*! A logical month enables things like: "date(2002,Mar,2) + months(2) ->
@@ -38,7 +37,7 @@ namespace date_time {
* also be a last-day-of-the-month.
*/
template<class base_config>
class BOOST_SYMBOL_VISIBLE months_duration
class months_duration
{
private:
typedef typename base_config::int_rep int_rep;
@@ -49,104 +48,106 @@ namespace date_time {
typedef months_duration<base_config> months_type;
typedef years_duration<base_config> years_type;
public:
BOOST_CXX14_CONSTEXPR months_duration(int_rep num) : _m(num) {}
BOOST_CXX14_CONSTEXPR months_duration(special_values sv) : _m(sv)
months_duration(int_rep num) : _m(num) {}
months_duration(special_values sv) : _m(sv)
{
_m = int_rep::from_special(sv);
}
int_rep number_of_months() const { return _m; }
//! returns a negative duration
BOOST_CXX14_CONSTEXPR duration_type get_neg_offset(const date_type& d) const
duration_type get_neg_offset(const date_type& d) const
{
month_adjustor_type m_adj(_m.as_number());
return duration_type(m_adj.get_neg_offset(d));
}
BOOST_CXX14_CONSTEXPR duration_type get_offset(const date_type& d) const
duration_type get_offset(const date_type& d) const
{
month_adjustor_type m_adj(_m.as_number());
return duration_type(m_adj.get_offset(d));
}
BOOST_CONSTEXPR bool operator==(const months_type& rhs) const
bool operator==(const months_type& rhs) const
{
return(_m == rhs._m);
}
BOOST_CONSTEXPR bool operator!=(const months_type& rhs) const
bool operator!=(const months_type& rhs) const
{
return(_m != rhs._m);
}
BOOST_CXX14_CONSTEXPR months_type operator+(const months_type& rhs)const
months_type operator+(const months_type& rhs)const
{
return months_type(_m + rhs._m);
}
BOOST_CXX14_CONSTEXPR months_type& operator+=(const months_type& rhs)
months_type& operator+=(const months_type& rhs)
{
_m = _m + rhs._m;
return *this;
}
BOOST_CXX14_CONSTEXPR months_type operator-(const months_type& rhs)const
months_type operator-(const months_type& rhs)const
{
return months_type(_m - rhs._m);
}
BOOST_CXX14_CONSTEXPR months_type& operator-=(const months_type& rhs)
months_type& operator-=(const months_type& rhs)
{
_m = _m - rhs._m;
return *this;
}
BOOST_CXX14_CONSTEXPR months_type operator*(const int_type rhs)const
months_type operator*(const int_type rhs)const
{
return months_type(_m * rhs);
}
BOOST_CXX14_CONSTEXPR months_type& operator*=(const int_type rhs)
months_type& operator*=(const int_type rhs)
{
_m = _m * rhs;
return *this;
}
BOOST_CXX14_CONSTEXPR months_type operator/(const int_type rhs)const
months_type operator/(const int_type rhs)const
{
return months_type(_m / rhs);
}
BOOST_CXX14_CONSTEXPR months_type& operator/=(const int_type rhs)
months_type& operator/=(const int_type rhs)
{
_m = _m / rhs;
return *this;
}
BOOST_CXX14_CONSTEXPR months_type operator+(const years_type& y)const
months_type operator+(const years_type& y)const
{
return months_type(y.number_of_years() * 12 + _m);
}
BOOST_CXX14_CONSTEXPR months_type& operator+=(const years_type& y)
months_type& operator+=(const years_type& y)
{
_m = y.number_of_years() * 12 + _m;
return *this;
}
BOOST_CXX14_CONSTEXPR months_type operator-(const years_type& y) const
months_type operator-(const years_type& y) const
{
return months_type(_m - y.number_of_years() * 12);
}
BOOST_CXX14_CONSTEXPR months_type& operator-=(const years_type& y)
months_type& operator-=(const years_type& y)
{
_m = _m - y.number_of_years() * 12;
return *this;
}
//
BOOST_CXX14_CONSTEXPR friend date_type operator+(const date_type& d, const months_type& m)
friend date_type operator+(const date_type& d, const months_type& m)
{
return d + m.get_offset(d);
}
BOOST_CXX14_CONSTEXPR friend date_type operator+=(date_type& d, const months_type& m)
friend date_type operator+=(date_type& d, const months_type& m)
{
return d += m.get_offset(d);
}
BOOST_CXX14_CONSTEXPR friend date_type operator-(const date_type& d, const months_type& m)
friend date_type operator-(const date_type& d, const months_type& m)
{
// get_neg_offset returns a negative duration, so we add
return d + m.get_neg_offset(d);
}
BOOST_CXX14_CONSTEXPR friend date_type operator-=(date_type& d, const months_type& m)
friend date_type operator-=(date_type& d, const months_type& m)
{
// get_neg_offset returns a negative duration, so we add
return d += m.get_neg_offset(d);
}
private:
int_rep _m;
};
@@ -158,7 +159,7 @@ namespace date_time {
* 2004-Feb-29).
*/
template<class base_config>
class BOOST_SYMBOL_VISIBLE years_duration
class years_duration
{
private:
typedef typename base_config::int_rep int_rep;
@@ -169,24 +170,24 @@ namespace date_time {
typedef years_duration<base_config> years_type;
typedef months_duration<base_config> months_type;
public:
BOOST_CXX14_CONSTEXPR years_duration(int_rep num) : _y(num) {}
BOOST_CXX14_CONSTEXPR years_duration(special_values sv) : _y(sv)
years_duration(int_rep num) : _y(num) {}
years_duration(special_values sv) : _y(sv)
{
_y = int_rep::from_special(sv);
}
BOOST_CXX14_CONSTEXPR int_rep number_of_years() const { return _y; }
int_rep number_of_years() const { return _y; }
//! returns a negative duration
BOOST_CXX14_CONSTEXPR duration_type get_neg_offset(const date_type& d) const
duration_type get_neg_offset(const date_type& d) const
{
month_adjustor_type m_adj(_y.as_number() * 12);
return duration_type(m_adj.get_neg_offset(d));
}
BOOST_CXX14_CONSTEXPR duration_type get_offset(const date_type& d) const
duration_type get_offset(const date_type& d) const
{
month_adjustor_type m_adj(_y.as_number() * 12);
return duration_type(m_adj.get_offset(d));
}
BOOST_CXX14_CONSTEXPR bool operator==(const years_type& rhs) const
bool operator==(const years_type& rhs) const
{
return(_y == rhs._y);
}
@@ -194,72 +195,75 @@ namespace date_time {
{
return(_y != rhs._y);
}
BOOST_CXX14_CONSTEXPR years_type operator+(const years_type& rhs)const
years_type operator+(const years_type& rhs)const
{
return years_type(_y + rhs._y);
}
BOOST_CXX14_CONSTEXPR years_type& operator+=(const years_type& rhs)
years_type& operator+=(const years_type& rhs)
{
_y = _y + rhs._y;
return *this;
}
BOOST_CXX14_CONSTEXPR years_type operator-(const years_type& rhs)const
years_type operator-(const years_type& rhs)const
{
return years_type(_y - rhs._y);
}
BOOST_CXX14_CONSTEXPR years_type& operator-=(const years_type& rhs)
years_type& operator-=(const years_type& rhs)
{
_y = _y - rhs._y;
return *this;
}
BOOST_CXX14_CONSTEXPR years_type operator*(const int_type rhs)const
years_type operator*(const int_type rhs)const
{
return years_type(_y * rhs);
}
BOOST_CXX14_CONSTEXPR years_type& operator*=(const int_type rhs)
years_type& operator*=(const int_type rhs)
{
_y = _y * rhs;
return *this;
}
BOOST_CXX14_CONSTEXPR years_type operator/(const int_type rhs)const
years_type operator/(const int_type rhs)const
{
return years_type(_y / rhs);
}
BOOST_CXX14_CONSTEXPR years_type& operator/=(const int_type rhs)
years_type& operator/=(const int_type rhs)
{
_y = _y / rhs;
return *this;
}
BOOST_CXX14_CONSTEXPR months_type operator+(const months_type& m) const
months_type operator+(const months_type& m) const
{
return(months_type(_y * 12 + m.number_of_months()));
}
BOOST_CXX14_CONSTEXPR months_type operator-(const months_type& m) const
months_type operator-(const months_type& m) const
{
return(months_type(_y * 12 - m.number_of_months()));
}
//
BOOST_CXX14_CONSTEXPR friend date_type operator+(const date_type& d, const years_type& y)
friend date_type operator+(const date_type& d, const years_type& y)
{
return d + y.get_offset(d);
}
BOOST_CXX14_CONSTEXPR friend date_type operator+=(date_type& d, const years_type& y)
friend date_type operator+=(date_type& d, const years_type& y)
{
return d += y.get_offset(d);
}
BOOST_CXX14_CONSTEXPR friend date_type operator-(const date_type& d, const years_type& y)
friend date_type operator-(const date_type& d, const years_type& y)
{
// get_neg_offset returns a negative duration, so we add
return d + y.get_neg_offset(d);
}
BOOST_CXX14_CONSTEXPR friend date_type operator-=(date_type& d, const years_type& y)
friend date_type operator-=(date_type& d, const years_type& y)
{
// get_neg_offset returns a negative duration, so we add
return d += y.get_neg_offset(d);
}
private:
int_rep _y;
};
}} // namespace boost::date_time
#endif // DATE_DURATION_TYPES_HPP___
+11 -13
View File
@@ -9,10 +9,10 @@
* $Date$
*/
#include <iterator> // ostreambuf_iterator
#include <locale>
#include <string>
#include <vector>
#include <iterator> // ostreambuf_iterator
#include <boost/throw_exception.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/date_time/compiler_config.hpp>
@@ -46,7 +46,7 @@ namespace boost { namespace date_time {
template <class date_type,
class CharT,
class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > >
class BOOST_SYMBOL_VISIBLE date_facet : public std::locale::facet {
class date_facet : public std::locale::facet {
public:
typedef typename date_type::duration_type duration_type;
// greg_weekday is gregorian_calendar::day_of_week_type
@@ -208,8 +208,7 @@ namespace boost { namespace date_time {
// return do_put_special(next, a_ios, fill_char, d.as_special());
//}
//The following line of code required the date to support a to_tm function
std::tm dtm;
std::memset(&dtm, 0, sizeof(dtm));
std::tm dtm = {};
dtm.tm_mon = m - 1;
return do_put_tm(next, a_ios, fill_char, dtm, m_month_format);
}
@@ -220,8 +219,7 @@ namespace boost { namespace date_time {
char_type fill_char,
const day_type& day) const
{
std::tm dtm;
std::memset(&dtm, 0, sizeof(dtm));
std::tm dtm = {};
dtm.tm_mday = day.as_number();
char_type tmp[3] = {'%','d'};
string_type temp_format(tmp);
@@ -237,8 +235,7 @@ namespace boost { namespace date_time {
// return do_put_special(next, a_ios, fill_char, d.as_special());
//}
//The following line of code required the date to support a to_tm function
std::tm dtm;
std::memset(&dtm, 0, sizeof(dtm));
std::tm dtm = {};
dtm.tm_wday = dow;
return do_put_tm(next, a_ios, fill_char, dtm, m_weekday_format);
}
@@ -316,23 +313,23 @@ namespace boost { namespace date_time {
string_type a_format) const
{
// update format string with custom names
if (!m_weekday_long_names.empty()) {
if (m_weekday_long_names.size()) {
boost::algorithm::replace_all(a_format,
long_weekday_format,
m_weekday_long_names[tm_value.tm_wday]);
}
if (!m_weekday_short_names.empty()) {
if (m_weekday_short_names.size()) {
boost::algorithm::replace_all(a_format,
short_weekday_format,
m_weekday_short_names[tm_value.tm_wday]);
}
if (!m_month_long_names.empty()) {
if (m_month_long_names.size()) {
boost::algorithm::replace_all(a_format,
long_month_format,
m_month_long_names[tm_value.tm_mon]);
}
if (!m_month_short_names.empty()) {
if (m_month_short_names.size()) {
boost::algorithm::replace_all(a_format,
short_month_format,
m_month_short_names[tm_value.tm_mon]);
@@ -408,7 +405,7 @@ namespace boost { namespace date_time {
template <class date_type,
class CharT,
class InItrT = std::istreambuf_iterator<CharT, std::char_traits<CharT> > >
class BOOST_SYMBOL_VISIBLE date_input_facet : public std::locale::facet {
class date_input_facet : public std::locale::facet {
public:
typedef typename date_type::duration_type duration_type;
// greg_weekday is gregorian_calendar::day_of_week_type
@@ -763,4 +760,5 @@ namespace boost { namespace date_time {
} } // namespaces
#endif
+1 -11
View File
@@ -11,7 +11,6 @@
#include "boost/date_time/iso_format.hpp"
#include "boost/date_time/compiler_config.hpp"
#include <boost/io/ios_state.hpp>
#include <string>
#include <sstream>
#include <iomanip>
@@ -52,13 +51,10 @@ namespace date_time {
}
case month_as_integer:
{
boost::io::basic_ios_fill_saver<charT> ifs(os);
os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number();
break;
}
default:
break;
}
return os;
} // format_month
@@ -83,13 +79,7 @@ namespace date_time {
{
typedef typename ymd_type::month_type month_type;
std::basic_ostringstream<charT> ss;
// Temporarily switch to classic locale to prevent possible formatting
// of year with comma or other character (for example 2,008).
ss.imbue(std::locale::classic());
ss << ymd.year;
ss.imbue(std::locale());
if (format_type::has_date_sep_chars()) {
ss << format_type::month_sep_char();
}
@@ -17,7 +17,6 @@
#include "boost/date_time/iso_format.hpp"
#include "boost/date_time/date_names_put.hpp"
#include "boost/date_time/parse_format_base.hpp"
#include <boost/io/ios_state.hpp>
//#include <string>
#include <sstream>
#include <iomanip>
@@ -57,8 +56,8 @@ namespace date_time {
}
case month_as_integer:
{
boost::io::basic_ios_fill_saver<charT> ifs(os);
os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number();
charT fill_char = '0';
os << std::setw(2) << std::setfill(fill_char) << month.as_number();
break;
}
@@ -133,8 +132,8 @@ namespace date_time {
ostream_type& os,
const facet_type& f)
{
boost::io::basic_ios_fill_saver<charT> ifs(os);
std::ostreambuf_iterator<charT> oitr(os);
charT fill_char = '0';
switch (f.date_order()) {
case ymd_order_iso: {
os << ymd.year;
@@ -145,7 +144,7 @@ namespace date_time {
if (f.has_date_sep_chars()) {
f.day_sep_char(oitr);
}
os << std::setw(2) << std::setfill(os.widen('0'))
os << std::setw(2) << std::setfill(fill_char)
<< ymd.day;
break;
}
@@ -154,7 +153,7 @@ namespace date_time {
if (f.has_date_sep_chars()) {
f.day_sep_char(oitr);
}
os << std::setw(2) << std::setfill(os.widen('0'))
os << std::setw(2) << std::setfill(fill_char)
<< ymd.day;
if (f.has_date_sep_chars()) {
f.month_sep_char(oitr);
@@ -163,7 +162,7 @@ namespace date_time {
break;
}
case ymd_order_dmy: {
os << std::setw(2) << std::setfill(os.widen('0'))
os << std::setw(2) << std::setfill(fill_char)
<< ymd.day;
if (f.has_date_sep_chars()) {
f.day_sep_char(oitr);
+53 -58
View File
@@ -2,10 +2,10 @@
#define DATE_TIME_DATE_GENERATORS_HPP__
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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
* Author: Jeff Garland, Bart Garst
* $Date$
*/
@@ -13,8 +13,8 @@
Definition and implementation of date algorithm templates
*/
#include <sstream>
#include <stdexcept>
#include <sstream>
#include <boost/throw_exception.hpp>
#include <boost/date_time/date.hpp>
#include <boost/date_time/compiler_config.hpp>
@@ -25,7 +25,7 @@ namespace date_time {
//! Base class for all generators that take a year and produce a date.
/*! This class is a base class for polymorphic function objects that take
a year and produce a concrete date.
@tparam date_type The type representing a date. This type must
@param date_type The type representing a date. This type must
export a calender_type which defines a year_type.
*/
template<class date_type>
@@ -34,16 +34,16 @@ namespace date_time {
public:
typedef typename date_type::calendar_type calendar_type;
typedef typename calendar_type::year_type year_type;
year_based_generator() {}
virtual ~year_based_generator() {}
year_based_generator() {};
virtual ~year_based_generator() {};
virtual date_type get_date(year_type y) const = 0;
//! Returns a string for use in a POSIX time_zone string
virtual std::string to_string() const = 0;
virtual std::string to_string() const =0;
};
//! Generates a date by applying the year to the given month and day.
/*!
Example usage:
Example usage:
@code
partial_date pd(1, Jan);
partial_date pd2(70);
@@ -98,7 +98,7 @@ namespace date_time {
* pg.get_date(2000); // returns 2000-2-29
* @endcode
*/
date_type get_date(year_type y) const BOOST_OVERRIDE
date_type get_date(year_type y) const
{
if((day_ == 29) && (month_ == 2) && !(calendar_type::is_leap_year(y))) {
std::ostringstream ss;
@@ -123,9 +123,9 @@ namespace date_time {
//months are equal
return (day_ < rhs.day_);
}
// added for streaming purposes
month_type month() const
month_type month() const
{
return month_;
}
@@ -135,15 +135,15 @@ namespace date_time {
}
//! Returns string suitable for use in POSIX time zone string
/*! Returns string formatted with up to 3 digits:
* Jan-01 == "0"
/*! Returns string formatted with up to 3 digits:
* Jan-01 == "0"
* Feb-29 == "58"
* Dec-31 == "365" */
std::string to_string() const BOOST_OVERRIDE
virtual std::string to_string() const
{
std::ostringstream ss;
date_type d(2004, month_, day_);
unsigned short c = d.day_of_year();
unsigned short c = d.day_of_year();
c--; // numbered 0-365 while day_of_year is 1 based...
ss << c;
return ss.str();
@@ -153,33 +153,24 @@ namespace date_time {
month_type month_;
};
//! Returns nth arg as string. 1 -> "first", 2 -> "second", max is 5.
inline const char* nth_as_str(int ele)
{
static const char* const _nth_as_str[] = {"out of range", "first", "second",
"third", "fourth", "fifth"};
if(ele >= 1 && ele <= 5) {
return _nth_as_str[ele];
}
else {
return _nth_as_str[0];
}
}
BOOST_DATE_TIME_DECL const char* nth_as_str(int n);
//! Useful generator functor for finding holidays
/*! Based on the idea in Cal. Calc. for finding holidays that are
* the 'first Monday of September'. When instantiated with
* 'fifth' kday of month, the result will be the last kday of month
* which can be the fourth or fifth depending on the structure of
* which can be the fourth or fifth depending on the structure of
* the month.
*
* The algorithm here basically guesses for the first
* day of the month. Then finds the first day of the correct
* type. That is, if the first of the month is a Tuesday
* and it needs Wednesday then we simply increment by a day
* and it needs Wenesday then we simply increment by a day
* and then we can add the length of a week until we get
* to the 'nth kday'. There are probably more efficient
* algorithms based on using a mod 7, but this one works
* to the 'nth kday'. There are probably more efficient
* algorithms based on using a mod 7, but this one works
* reasonably well for basic applications.
* \ingroup date_alg
*/
@@ -201,7 +192,7 @@ namespace date_time {
dow_(dow)
{}
//! Return a concrete date when provided with a year specific year.
date_type get_date(year_type y) const BOOST_OVERRIDE
date_type get_date(year_type y) const
{
date_type d(y, month_, 1); //first day of month
duration_type one_day(1);
@@ -239,10 +230,10 @@ namespace date_time {
}
//! Returns string suitable for use in POSIX time zone string
/*! Returns a string formatted as "M4.3.0" ==> 3rd Sunday in April. */
std::string to_string() const BOOST_OVERRIDE
virtual std::string to_string() const
{
std::ostringstream ss;
ss << 'M'
ss << 'M'
<< static_cast<int>(month_) << '.'
<< static_cast<int>(wn_) << '.'
<< static_cast<int>(dow_);
@@ -253,7 +244,7 @@ namespace date_time {
week_num wn_;
day_of_week_type dow_;
};
//! Useful generator functor for finding holidays and daylight savings
/*! Similar to nth_kday_of_month, but requires less paramters
* \ingroup date_alg
@@ -276,7 +267,7 @@ namespace date_time {
dow_(dow)
{}
//! Return a concrete date when provided with a year specific year.
date_type get_date(year_type year) const BOOST_OVERRIDE
date_type get_date(year_type year) const
{
date_type d(year, month_,1);
duration_type one_day(1);
@@ -296,10 +287,10 @@ namespace date_time {
}
//! Returns string suitable for use in POSIX time zone string
/*! Returns a string formatted as "M4.1.0" ==> 1st Sunday in April. */
std::string to_string() const BOOST_OVERRIDE
virtual std::string to_string() const
{
std::ostringstream ss;
ss << 'M'
ss << 'M'
<< static_cast<int>(month_) << '.'
<< 1 << '.'
<< static_cast<int>(dow_);
@@ -309,14 +300,14 @@ namespace date_time {
month_type month_;
day_of_week_type dow_;
};
//! Calculate something like Last Sunday of January
/*! Useful generator functor for finding holidays and daylight savings
* Get the last day of the month and then calculate the difference
* to the last previous day.
* @tparam date_type A date class that exports day_of_week, month_type, etc.
* @param date_type A date class that exports day_of_week, month_type, etc.
* \ingroup date_alg
*/
template<class date_type>
@@ -337,7 +328,7 @@ namespace date_time {
dow_(dow)
{}
//! Return a concrete date when provided with a year specific year.
date_type get_date(year_type year) const BOOST_OVERRIDE
date_type get_date(year_type year) const
{
date_type d(year, month_, calendar_type::end_of_month_day(year,month_));
duration_type one_day(1);
@@ -357,10 +348,10 @@ namespace date_time {
}
//! Returns string suitable for use in POSIX time zone string
/*! Returns a string formatted as "M4.5.0" ==> last Sunday in April. */
std::string to_string() const BOOST_OVERRIDE
virtual std::string to_string() const
{
std::ostringstream ss;
ss << 'M'
ss << 'M'
<< static_cast<int>(month_) << '.'
<< 5 << '.'
<< static_cast<int>(dow_);
@@ -370,8 +361,8 @@ namespace date_time {
month_type month_;
day_of_week_type dow_;
};
//! Calculate something like "First Sunday after Jan 1,2002
/*! Date generator that takes a date and finds kday after
*@code
@@ -409,7 +400,7 @@ namespace date_time {
private:
day_of_week_type dow_;
};
//! Calculate something like "First Sunday before Jan 1,2002
/*! Date generator that takes a date and finds kday after
*@code
@@ -447,10 +438,10 @@ namespace date_time {
private:
day_of_week_type dow_;
};
//! Calculates the number of days until the next weekday
/*! Calculates the number of days until the next weekday.
* If the date given falls on a Sunday and the given weekday
* If the date given falls on a Sunday and the given weekday
* is Tuesday the result will be 2 days */
template<typename date_type, class weekday_type>
inline
@@ -467,8 +458,8 @@ namespace date_time {
//! Calculates the number of days since the previous weekday
/*! Calculates the number of days since the previous weekday
* If the date given falls on a Sunday and the given weekday
* is Tuesday the result will be 5 days. The answer will be a positive
* If the date given falls on a Sunday and the given weekday
* is Tuesday the result will be 5 days. The answer will be a positive
* number because Tuesday is 5 days before Sunday, not -5 days before. */
template<typename date_type, class weekday_type>
inline
@@ -486,9 +477,9 @@ namespace date_time {
}
//! Generates a date object representing the date of the following weekday from the given date
/*! Generates a date object representing the date of the following
* weekday from the given date. If the date given is 2004-May-9
* (a Sunday) and the given weekday is Tuesday then the resulting date
/*! Generates a date object representing the date of the following
* weekday from the given date. If the date given is 2004-May-9
* (a Sunday) and the given weekday is Tuesday then the resulting date
* will be 2004-May-11. */
template<class date_type, class weekday_type>
inline
@@ -498,9 +489,9 @@ namespace date_time {
}
//! Generates a date object representing the date of the previous weekday from the given date
/*! Generates a date object representing the date of the previous
* weekday from the given date. If the date given is 2004-May-9
* (a Sunday) and the given weekday is Tuesday then the resulting date
/*! Generates a date object representing the date of the previous
* weekday from the given date. If the date given is 2004-May-9
* (a Sunday) and the given weekday is Tuesday then the resulting date
* will be 2004-May-4. */
template<class date_type, class weekday_type>
inline
@@ -511,4 +502,8 @@ namespace date_time {
} } //namespace date_time
#endif
+19 -19
View File
@@ -2,7 +2,7 @@
#define DATE_ITERATOR_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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
@@ -32,7 +32,7 @@ namespace date_time {
template<class date_type>
class date_itr_base {
// works, but benefit unclear at the moment
// class date_itr_base : public std::iterator<std::input_iterator_tag,
// class date_itr_base : public std::iterator<std::input_iterator_tag,
// date_type, void, void, void>{
public:
typedef typename date_type::duration_type duration_type;
@@ -40,31 +40,31 @@ namespace date_time {
typedef std::input_iterator_tag iterator_category;
date_itr_base(date_type d) : current_(d) {}
virtual ~date_itr_base() {}
date_itr_base& operator++()
virtual ~date_itr_base() {};
date_itr_base& operator++()
{
current_ = current_ + get_offset(current_);
return *this;
}
date_itr_base& operator--()
date_itr_base& operator--()
{
current_ = current_ + get_neg_offset(current_);
return *this;
}
virtual duration_type get_offset(const date_type& current) const=0;
virtual duration_type get_neg_offset(const date_type& current) const=0;
const date_type& operator*() const {return current_;}
const date_type* operator->() const {return &current_;}
bool operator< (const date_type& d) const {return current_ < d;}
bool operator<= (const date_type& d) const {return current_ <= d;}
bool operator> (const date_type& d) const {return current_ > d;}
bool operator>= (const date_type& d) const {return current_ >= d;}
bool operator== (const date_type& d) const {return current_ == d;}
bool operator!= (const date_type& d) const {return current_ != d;}
date_type operator*() {return current_;};
date_type* operator->() {return &current_;};
bool operator< (const date_type& d) {return current_ < d;}
bool operator<= (const date_type& d) {return current_ <= d;}
bool operator> (const date_type& d) {return current_ > d;}
bool operator>= (const date_type& d) {return current_ >= d;}
bool operator== (const date_type& d) {return current_ == d;}
bool operator!= (const date_type& d) {return current_ != d;}
private:
date_type current_;
};
//! Overrides the base date iterator providing hook for functors
/*
* <b>offset_functor</b>
@@ -77,9 +77,9 @@ namespace date_time {
class date_itr : public date_itr_base<date_type> {
public:
typedef typename date_type::duration_type duration_type;
date_itr(date_type d, int factor=1) :
date_itr_base<date_type>(d),
of_(factor)
date_itr(date_type d, int factor=1) :
date_itr_base<date_type>(d),
of_(factor)
{}
private:
virtual duration_type get_offset(const date_type& current) const
@@ -92,9 +92,9 @@ namespace date_time {
}
offset_functor of_;
};
} } //namespace date_time
+32 -33
View File
@@ -2,23 +2,22 @@
#define DATE_TIME_DATE_NAMES_PUT_HPP___
/* Copyright (c) 2002-2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include <boost/date_time/locale_config.hpp> // set BOOST_DATE_TIME_NO_LOCALE
#include "boost/date_time/locale_config.hpp" // set BOOST_DATE_TIME_NO_LOCALE
#ifndef BOOST_DATE_TIME_NO_LOCALE
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/date_defs.hpp>
#include <boost/date_time/parse_format_base.hpp>
#include <boost/lexical_cast.hpp>
#include "boost/date_time/special_defs.hpp"
#include "boost/date_time/date_defs.hpp"
#include "boost/date_time/parse_format_base.hpp"
#include "boost/lexical_cast.hpp"
#include <locale>
@@ -28,22 +27,22 @@ namespace date_time {
//! Output facet base class for gregorian dates.
/*! This class is a base class for date facets used to localize the
* names of months and the names of days in the week.
*
*
* Requirements of Config
* - define an enumeration month_enum that enumerates the months.
* - define an enumeration month_enum that enumerates the months.
* The enumeration should be '1' based eg: Jan==1
* - define as_short_string and as_long_string
*
* (see langer & kreft p334).
*
*
*/
template<class Config,
class charT = char,
class charT = char,
class OutputIterator = std::ostreambuf_iterator<charT> >
class BOOST_SYMBOL_VISIBLE date_names_put : public std::locale::facet
class date_names_put : public std::locale::facet
{
public:
date_names_put() {}
date_names_put() {};
typedef OutputIterator iter_type;
typedef typename Config::month_type month_type;
typedef typename Config::month_enum month_enum;
@@ -119,7 +118,7 @@ namespace date_time {
put_string(oitr, gm.as_short_string(c));
}
//! Default facet implementation uses month_type defaults
virtual void do_put_month_long(iter_type& oitr,
virtual void do_put_month_long(iter_type& oitr,
month_enum moy) const
{
month_type gm(moy);
@@ -161,7 +160,7 @@ namespace date_time {
string_type s(separator); //put in '-'
put_string(oitr, s);
}
//! Default for date order
//! Default for date order
virtual ymd_order_spec do_date_order() const
{
return ymd_order_iso;
@@ -187,29 +186,29 @@ namespace date_time {
}
}
};
template<class Config, class charT, class OutputIterator>
const typename date_names_put<Config, charT, OutputIterator>::char_type
date_names_put<Config, charT, OutputIterator>::default_special_value_names[3][17] = {
const typename date_names_put<Config, charT, OutputIterator>::char_type
date_names_put<Config, charT, OutputIterator>::default_special_value_names[3][17] = {
{'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'},
{'-','i','n','f','i','n','i','t','y'},
{'+','i','n','f','i','n','i','t','y'} };
template<class Config, class charT, class OutputIterator>
const typename date_names_put<Config, charT, OutputIterator>::char_type
date_names_put<Config, charT, OutputIterator>::separator[2] =
const typename date_names_put<Config, charT, OutputIterator>::char_type
date_names_put<Config, charT, OutputIterator>::separator[2] =
{'-', '\0'} ;
//! Generate storage location for a std::locale::id
//! Generate storage location for a std::locale::id
template<class Config, class charT, class OutputIterator>
std::locale::id date_names_put<Config, charT, OutputIterator>::id;
//! A date name output facet that takes an array of char* to define strings
template<class Config,
class charT = char,
class charT = char,
class OutputIterator = std::ostreambuf_iterator<charT> >
class BOOST_SYMBOL_VISIBLE all_date_names_put : public date_names_put<Config, charT, OutputIterator>
class all_date_names_put : public date_names_put<Config, charT, OutputIterator>
{
public:
all_date_names_put(const charT* const month_short_names[],
@@ -231,29 +230,29 @@ namespace date_time {
separator_char_[0] = separator_char;
separator_char_[1] = '\0';
}
};
typedef OutputIterator iter_type;
typedef typename Config::month_enum month_enum;
typedef typename Config::weekday_enum weekday_enum;
typedef typename Config::special_value_enum special_value_enum;
const charT* const* get_short_month_names() const
const charT* const* get_short_month_names() const
{
return month_short_names_;
}
const charT* const* get_long_month_names() const
const charT* const* get_long_month_names() const
{
return month_long_names_;
}
const charT* const* get_special_value_names() const
const charT* const* get_special_value_names() const
{
return special_value_names_;
}
const charT* const* get_short_weekday_names()const
const charT* const* get_short_weekday_names()const
{
return weekday_short_names_;
}
const charT* const* get_long_weekday_names()const
const charT* const* get_long_weekday_names()const
{
return weekday_long_names_;
}
@@ -264,7 +263,7 @@ namespace date_time {
{
this->put_string(oitr, month_short_names_[moy-1]);
}
//! Long month names
//! Long month names
virtual void do_put_month_long(iter_type& oitr, month_enum moy) const
{
this->put_string(oitr, month_long_names_[moy-1]);
@@ -311,7 +310,7 @@ namespace date_time {
const charT* const* weekday_long_names_;
charT separator_char_[2];
ymd_order_spec order_spec_;
month_format_spec month_format_spec_;
month_format_spec month_format_spec_;
};
} } //namespace boost::date_time
+27 -53
View File
@@ -9,16 +9,13 @@
* $Date$
*/
#include <map>
#include <string>
#include <sstream>
#include <iterator>
#include <algorithm>
#include <boost/tokenizer.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/parse_format_base.hpp>
#include <boost/date_time/period.hpp>
#if defined(BOOST_DATE_TIME_NO_LOCALE)
#include <cctype> // ::tolower(int)
@@ -57,6 +54,8 @@ namespace date_time {
}
//! Helper function for parse_date.
/* Used by-value parameter because we change the string and may
* want to preserve the original argument */
template<class month_type>
inline unsigned short
month_str_to_ushort(std::string const& s) {
@@ -65,59 +64,34 @@ namespace date_time {
}
else {
std::string str = convert_to_lower(s);
//c++98 support
#if defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
static std::map<std::string, unsigned short> month_map;
typedef std::map<std::string, unsigned short>::value_type vtype;
if( month_map.empty() ) {
month_map.insert( vtype("jan", static_cast<unsigned short>(1)) );
month_map.insert( vtype("january", static_cast<unsigned short>(1)) );
month_map.insert( vtype("feb", static_cast<unsigned short>(2)) );
month_map.insert( vtype("february", static_cast<unsigned short>(2)) );
month_map.insert( vtype("mar", static_cast<unsigned short>(3)) );
month_map.insert( vtype("march", static_cast<unsigned short>(3)) );
month_map.insert( vtype("apr", static_cast<unsigned short>(4)) );
month_map.insert( vtype("april", static_cast<unsigned short>(4)) );
month_map.insert( vtype("may", static_cast<unsigned short>(5)) );
month_map.insert( vtype("jun", static_cast<unsigned short>(6)) );
month_map.insert( vtype("june", static_cast<unsigned short>(6)) );
month_map.insert( vtype("jul", static_cast<unsigned short>(7)) );
month_map.insert( vtype("july", static_cast<unsigned short>(7)) );
month_map.insert( vtype("aug", static_cast<unsigned short>(8)) );
month_map.insert( vtype("august", static_cast<unsigned short>(8)) );
month_map.insert( vtype("sep", static_cast<unsigned short>(9)) );
month_map.insert( vtype("september", static_cast<unsigned short>(9)) );
month_map.insert( vtype("oct", static_cast<unsigned short>(10)) );
month_map.insert( vtype("october", static_cast<unsigned short>(10)) );
month_map.insert( vtype("nov", static_cast<unsigned short>(11)) );
month_map.insert( vtype("november", static_cast<unsigned short>(11)) );
month_map.insert( vtype("dec", static_cast<unsigned short>(12)) );
month_map.insert( vtype("december", static_cast<unsigned short>(12)) );
}
#else //c+11 and beyond
static std::map<std::string, unsigned short> month_map =
{ { "jan", static_cast<unsigned short>(1) }, { "january", static_cast<unsigned short>(1) },
{ "feb", static_cast<unsigned short>(2) }, { "february", static_cast<unsigned short>(2) },
{ "mar", static_cast<unsigned short>(3) }, { "march", static_cast<unsigned short>(3) },
{ "apr", static_cast<unsigned short>(4) }, { "april", static_cast<unsigned short>(4) },
{ "may", static_cast<unsigned short>(5) },
{ "jun", static_cast<unsigned short>(6) }, { "june", static_cast<unsigned short>(6) },
{ "jul", static_cast<unsigned short>(7) }, { "july", static_cast<unsigned short>(7) },
{ "aug", static_cast<unsigned short>(8) }, { "august", static_cast<unsigned short>(8) },
{ "sep", static_cast<unsigned short>(9) }, { "september", static_cast<unsigned short>(9) },
{ "oct", static_cast<unsigned short>(10) }, { "october", static_cast<unsigned short>(10)},
{ "nov", static_cast<unsigned short>(11) }, { "november", static_cast<unsigned short>(11)},
{ "dec", static_cast<unsigned short>(12) }, { "december", static_cast<unsigned short>(12)}
};
#endif
std::map<std::string, unsigned short>::const_iterator mitr = month_map.find( str );
if ( mitr != month_map.end() ) {
return mitr->second;
typename month_type::month_map_ptr_type ptr = month_type::get_month_map_ptr();
typename month_type::month_map_type::iterator iter = ptr->find(str);
if(iter != ptr->end()) { // required for STLport
return iter->second;
}
}
return 13; // intentionally out of range - name not found
}
//! Find index of a string in either of 2 arrays
/*! find_match searches both arrays for a match to 's'. Both arrays
* must contain 'size' elements. The index of the match is returned.
* If no match is found, 'size' is returned.
* Ex. "Jan" returns 0, "Dec" returns 11, "Tue" returns 2.
* 'size' can be sent in with: (greg_month::max)() (which 12),
* (greg_weekday::max)() + 1 (which is 7) or date_time::NumSpecialValues */
template<class charT>
short find_match(const charT* const* short_names,
const charT* const* long_names,
short size,
const std::basic_string<charT>& s) {
for(short i = 0; i < size; ++i){
if(short_names[i] == s || long_names[i] == s){
return i;
}
}
return size; // not-found, return a value out of range
}
//! Generic function to parse a delimited date (eg: 2002-02-10)
/*! Accepted formats are: "2003-02-10" or " 2003-Feb-10" or
@@ -139,6 +113,7 @@ namespace date_time {
spec_str = "mdy";
}
typedef typename date_type::year_type year_type;
typedef typename date_type::month_type month_type;
unsigned pos = 0;
unsigned short year(0), month(0), day(0);
@@ -173,7 +148,6 @@ namespace date_time {
day = boost::lexical_cast<unsigned short>(*beg);
break;
}
default: break;
} //switch
}
return date_type(year, month, day);
@@ -185,6 +159,7 @@ namespace date_time {
parse_undelimited_date(const std::string& s) {
int offsets[] = {4,2,2};
int pos = 0;
typedef typename date_type::year_type year_type;
//typename date_type::ymd_type ymd((year_type::min)(),1,1);
unsigned short y = 0, m = 0, d = 0;
@@ -205,7 +180,6 @@ namespace date_time {
case 0: y = i; break;
case 1: m = i; break;
case 2: d = i; break;
default: break;
}
pos++;
}
+62 -62
View File
@@ -2,7 +2,7 @@
#define DATE_TIME_DST_RULES_HPP__
/* Copyright (c) 2002,2003, 2007 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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
@@ -21,12 +21,12 @@
namespace boost {
namespace date_time {
enum time_is_dst_result {is_not_in_dst, is_in_dst,
enum time_is_dst_result {is_not_in_dst, is_in_dst,
ambiguous, invalid_time_label};
//! Dynamic class used to caluclate dst transition information
template<class date_type_,
template<class date_type_,
class time_duration_type_>
class dst_calculator
{
@@ -37,14 +37,14 @@ namespace boost {
//! Check the local time offset when on dst start day
/*! On this dst transition, the time label between
* the transition boundary and the boudary + the offset
* are invalid times. If before the boundary then still
* not in dst.
* are invalid times. If before the boundary then still
* not in dst.
*@param time_of_day Time offset in the day for the local time
*@param dst_start_offset_minutes Local day offset for start of dst
*@param dst_length_minutes Number of minutes to adjust clock forward
*@retval status of time label w.r.t. dst
*/
static time_is_dst_result
static time_is_dst_result
process_local_dst_start_day(const time_duration_type& time_of_day,
unsigned int dst_start_offset_minutes,
long dst_length_minutes)
@@ -57,19 +57,19 @@ namespace boost {
if (time_of_day >= time_duration_type(0,offset,0)) {
return is_in_dst;
}
return invalid_time_label;
return invalid_time_label;
}
//! Check the local time offset when on the last day of dst
/*! This is the calculation for the DST end day. On that day times
* prior to the conversion time - dst_length (1 am in US) are still
* in dst. Times between the above and the switch time are
* prior to the conversion time - dst_length (1 am in US) are still
* in dst. Times between the above and the switch time are
* ambiguous. Times after the start_offset are not in dst.
*@param time_of_day Time offset in the day for the local time
*@param dst_end_offset_minutes Local time of day for end of dst
*@retval status of time label w.r.t. dst
*/
static time_is_dst_result
static time_is_dst_result
process_local_dst_end_day(const time_duration_type& time_of_day,
unsigned int dst_end_offset_minutes,
long dst_length_minutes)
@@ -86,32 +86,32 @@ namespace boost {
}
//! Calculates if the given local time is dst or not
/*! Determines if the time is really in DST or not. Also checks for
/*! Determines if the time is really in DST or not. Also checks for
* invalid and ambiguous.
* @param current_day The day to check for dst
* @param time_of_day Time offset within the day to check
* @param time_of_day Time offset within the day to check
* @param dst_start_day Starting day of dst for the given locality
* @param dst_start_offset Time offset within day for dst boundary
* @param dst_end_day Ending day of dst for the given locality
* @param dst_end_offset Time offset within day given in dst for dst boundary
* @param dst_length_minutes length of dst adjusment
* @param dst_length lenght of dst adjusment
* @retval The time is either ambiguous, invalid, in dst, or not in dst
*/
static time_is_dst_result
static time_is_dst_result
local_is_dst(const date_type& current_day,
const time_duration_type& time_of_day,
const date_type& dst_start_day,
const time_duration_type& dst_start_offset,
const date_type& dst_end_day,
const time_duration_type& dst_end_offset,
const time_duration_type& dst_length)
const time_duration_type& dst_length_minutes)
{
unsigned int start_minutes = static_cast<unsigned>(
dst_start_offset.hours() * 60 + dst_start_offset.minutes());
unsigned int end_minutes = static_cast<unsigned>(
dst_end_offset.hours() * 60 + dst_end_offset.minutes());
long length_minutes = static_cast<long>(
dst_length.hours() * 60 + dst_length.minutes());
unsigned int start_minutes =
dst_start_offset.hours() * 60 + dst_start_offset.minutes();
unsigned int end_minutes =
dst_end_offset.hours() * 60 + dst_end_offset.minutes();
long length_minutes =
dst_length_minutes.hours() * 60 + dst_length_minutes.minutes();
return local_is_dst(current_day, time_of_day,
dst_start_day, start_minutes,
@@ -120,20 +120,20 @@ namespace boost {
}
//! Calculates if the given local time is dst or not
/*! Determines if the time is really in DST or not. Also checks for
/*! Determines if the time is really in DST or not. Also checks for
* invalid and ambiguous.
* @param current_day The day to check for dst
* @param time_of_day Time offset within the day to check
* @param time_of_day Time offset within the day to check
* @param dst_start_day Starting day of dst for the given locality
* @param dst_start_offset_minutes Offset within day for dst
* @param dst_start_offset_minutes Offset within day for dst
* boundary (eg 120 for US which is 02:00:00)
* @param dst_end_day Ending day of dst for the given locality
* @param dst_end_offset_minutes Offset within day given in dst for dst
* @param dst_end_offset_minutes Offset within day given in dst for dst
* boundary (eg 120 for US which is 02:00:00)
* @param dst_length_minutes Length of dst adjusment (eg: 60 for US)
* @retval The time is either ambiguous, invalid, in dst, or not in dst
*/
static time_is_dst_result
static time_is_dst_result
local_is_dst(const date_type& current_day,
const time_duration_type& time_of_day,
const date_type& dst_start_day,
@@ -165,7 +165,7 @@ namespace boost {
dst_start_offset_minutes,
dst_length_minutes);
}
if (current_day == dst_end_day) {
return process_local_dst_end_day(time_of_day,
dst_end_offset_minutes,
@@ -183,29 +183,29 @@ namespace boost {
* calculation at compile time covering all the cases. Unfortunately
* because of the number of dimensions related to daylight savings
* calculation the number of parameters is high. In addition, the
* start and end transition rules are complex types that specify
* start and end transition rules are complex types that specify
* an algorithm for calculation of the starting day and ending
* day of daylight savings time including the month and day
* day of daylight savings time including the month and day
* specifications (eg: last sunday in October).
*
* @param date_type A type that represents dates, typically gregorian::date
* @param time_duration_type Used for the offset in the day calculations
* @param dst_traits A set of traits that define the rules of dst
* @param dst_traits A set of traits that define the rules of dst
* calculation. The dst_trait must include the following:
* start_rule_functor - Rule to calculate the starting date of a
* dst transition (eg: last_kday_of_month).
* start_day - static function that returns month of dst start for
* start_day - static function that returns month of dst start for
* start_rule_functor
* start_month -static function that returns day or day of week for
* start_month -static function that returns day or day of week for
* dst start of dst
* end_rule_functor - Rule to calculate the end of dst day.
* end_day - static fucntion that returns end day for end_rule_functor
* end_month - static function that returns end month for end_rule_functor
* dst_start_offset_minutes - number of minutes from start of day to transition to dst -- 120 (or 2:00 am) is typical for the U.S. and E.U.
* dst_start_offset_minutes - number of minutes from start of day to transition off of dst -- 180 (or 3:00 am) is typical for E.U.
* dst_start_offset_minutes - number of minutes from start of day to transition off of dst -- 180 (or 3:00 am) is typical for E.U.
* dst_length_minutes - number of minutes that dst shifts clock
*/
template<class date_type,
template<class date_type,
class time_duration_type,
class dst_traits>
class dst_calc_engine
@@ -216,12 +216,12 @@ namespace boost {
typedef dst_calculator<date_type, time_duration_type> dstcalc;
//! Calculates if the given local time is dst or not
/*! Determines if the time is really in DST or not. Also checks for
/*! Determines if the time is really in DST or not. Also checks for
* invalid and ambiguous.
* @retval The time is either ambiguous, invalid, in dst, or not in dst
*/
static time_is_dst_result local_is_dst(const date_type& d,
const time_duration_type& td)
const time_duration_type& td)
{
year_type y = d.year();
@@ -230,10 +230,10 @@ namespace boost {
return dstcalc::local_is_dst(d,td,
dst_start,
dst_traits::dst_start_offset_minutes(),
dst_end,
dst_traits::dst_end_offset_minutes(),
dst_end,
dst_traits::dst_end_offset_minutes(),
dst_traits::dst_shift_length_minutes());
}
static bool is_dst_boundary_day(date_type d)
@@ -244,14 +244,14 @@ namespace boost {
}
//! The time of day for the dst transition (eg: typically 01:00:00 or 02:00:00)
static time_duration_type dst_offset()
static time_duration_type dst_offset()
{
return time_duration_type(0,dst_traits::dst_shift_length_minutes(),0);
}
static date_type local_dst_start_day(year_type year)
{
return dst_traits::local_dst_start_day(year);
return dst_traits::local_dst_start_day(year);
}
static date_type local_dst_end_day(year_type year)
@@ -267,11 +267,11 @@ namespace boost {
* In 2007 US/Canada DST rules changed
* (http://en.wikipedia.org/wiki/Energy_Policy_Act_of_2005#Change_to_daylight_saving_time).
*/
template<class date_type_,
template<class date_type_,
class time_duration_type_,
unsigned int dst_start_offset_minutes=120, //from start of day
unsigned int dst_start_offset_minutes=120, //from start of day
short dst_length_minutes=60> //1 hour == 60 min in US
class us_dst_rules
class us_dst_rules
{
public:
typedef time_duration_type_ time_duration_type;
@@ -284,12 +284,12 @@ namespace boost {
typedef dst_calculator<date_type, time_duration_type> dstcalc;
//! Calculates if the given local time is dst or not
/*! Determines if the time is really in DST or not. Also checks for
/*! Determines if the time is really in DST or not. Also checks for
* invalid and ambiguous.
* @retval The time is either ambiguous, invalid, in dst, or not in dst
*/
static time_is_dst_result local_is_dst(const date_type& d,
const time_duration_type& td)
const time_duration_type& td)
{
year_type y = d.year();
@@ -297,9 +297,9 @@ namespace boost {
date_type dst_end = local_dst_end_day(y);
return dstcalc::local_is_dst(d,td,
dst_start,dst_start_offset_minutes,
dst_end, dst_start_offset_minutes,
dst_end, dst_start_offset_minutes,
dst_length_minutes);
}
@@ -314,12 +314,12 @@ namespace boost {
{
if (year >= year_type(2007)) {
//second sunday in march
nkday ssim(nkday::second, Sunday, date_time::Mar);
return ssim.get_date(year);
nkday ssim(nkday::second, Sunday, gregorian::Mar);
return ssim.get_date(year);
} else {
//first sunday in april
fkday fsia(Sunday, date_time::Apr);
return fsia.get_date(year);
fkday fsia(Sunday, gregorian::Apr);
return fsia.get_date(year);
}
}
@@ -327,11 +327,11 @@ namespace boost {
{
if (year >= year_type(2007)) {
//first sunday in november
fkday fsin(Sunday, date_time::Nov);
return fsin.get_date(year);
fkday fsin(Sunday, gregorian::Nov);
return fsin.get_date(year);
} else {
//last sunday in october
lkday lsio(Sunday, date_time::Oct);
lkday lsio(Sunday, gregorian::Oct);
return lsio.get_date(year);
}
}
@@ -358,25 +358,25 @@ namespace boost {
//! Calculates if the given local time is dst or not
/*! @retval Always is_not_in_dst since this is for zones without dst
*/
static time_is_dst_result local_is_dst(const date_type&,
const time_duration_type&)
static time_is_dst_result local_is_dst(const date_type&,
const time_duration_type&)
{
return is_not_in_dst;
}
//! Calculates if the given utc time is in dst
static time_is_dst_result utc_is_dst(const date_type&,
const time_duration_type&)
static time_is_dst_result utc_is_dst(const date_type&,
const time_duration_type&)
{
return is_not_in_dst;
}
static bool is_dst_boundary_day(date_type /*d*/)
static bool is_dst_boundary_day(date_type d)
{
return false;
}
static time_duration_type dst_offset()
static time_duration_type dst_offset()
{
return time_duration_type(0,0,0);
}
@@ -7,7 +7,7 @@
#ifndef DATE_TIME_DATE_DST_TRANSITION_DAY_GEN_HPP__
#define DATE_TIME_DATE_DST_TRANSITION_DAY_GEN_HPP__
#include <string>
namespace boost {
namespace date_time {
@@ -18,7 +18,7 @@ namespace date_time {
{
public:
typedef typename date_type::year_type year_type;
virtual ~dst_day_calc_rule() {}
virtual ~dst_day_calc_rule() {};
virtual date_type start_day(year_type y) const=0;
virtual std::string start_rule_as_string() const=0;
virtual date_type end_day(year_type y) const=0;
@@ -29,7 +29,7 @@ namespace date_time {
//! Canonical form for a class that provides day rule calculation
/*! This class is used to generate specific sets of dst rules
*
*@tparam spec Provides a specifiction of the function object types used
*@param spec Provides a specifiction of the function object types used
* to generate start and end days of daylight savings as well
* as the date type.
*/
+94 -8
View File
@@ -19,6 +19,10 @@
#if defined(BOOST_HAS_FTIME) // skip this file if no FILETIME
#if defined(BOOST_USE_WINDOWS_H)
# include <windows.h>
#endif
#include <boost/cstdint.hpp>
#include <boost/date_time/time.hpp>
#include <boost/date_time/date_defs.hpp>
@@ -27,6 +31,85 @@ namespace boost {
namespace date_time {
namespace winapi {
#if !defined(BOOST_USE_WINDOWS_H)
extern "C" {
struct FILETIME
{
boost::uint32_t dwLowDateTime;
boost::uint32_t dwHighDateTime;
};
struct SYSTEMTIME
{
boost::uint16_t wYear;
boost::uint16_t wMonth;
boost::uint16_t wDayOfWeek;
boost::uint16_t wDay;
boost::uint16_t wHour;
boost::uint16_t wMinute;
boost::uint16_t wSecond;
boost::uint16_t wMilliseconds;
};
__declspec(dllimport) void __stdcall GetSystemTimeAsFileTime(FILETIME* lpFileTime);
__declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const FILETIME* lpFileTime, FILETIME* lpLocalFileTime);
__declspec(dllimport) void __stdcall GetSystemTime(SYSTEMTIME* lpSystemTime);
__declspec(dllimport) int __stdcall SystemTimeToFileTime(const SYSTEMTIME* lpSystemTime, FILETIME* lpFileTime);
} // extern "C"
#endif // defined(BOOST_USE_WINDOWS_H)
typedef FILETIME file_time;
typedef SYSTEMTIME system_time;
inline void get_system_time_as_file_time(file_time& ft)
{
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
// Some runtime library implementations expect local times as the norm for ctime.
file_time ft_utc;
GetSystemTimeAsFileTime(&ft_utc);
FileTimeToLocalFileTime(&ft_utc, &ft);
#elif defined(BOOST_NO_GETSYSTEMTIMEASFILETIME)
system_time st;
GetSystemTime(&st);
SystemTimeToFileTime(&st, &ft);
#else
GetSystemTimeAsFileTime(&ft);
#endif
}
/*!
* The function converts file_time into number of microseconds elapsed since 1970-Jan-01
*
* \note Only dates after 1970-Jan-01 are supported. Dates before will be wrapped.
*
* \note The function is templated on the FILETIME type, so that
* it can be used with both native FILETIME and the ad-hoc
* boost::date_time::winapi::file_time type.
*/
template< typename FileTimeT >
inline boost::uint64_t file_time_to_microseconds(FileTimeT const& ft)
{
/* shift is difference between 1970-Jan-01 & 1601-Jan-01
* in 100-nanosecond intervals */
const uint64_t shift = 116444736000000000ULL; // (27111902 << 32) + 3577643008
union {
FileTimeT as_file_time;
uint64_t as_integer; // 100-nanos since 1601-Jan-01
} caster;
caster.as_file_time = ft;
caster.as_integer -= shift; // filetime is now 100-nanos since 1970-Jan-01
return (caster.as_integer / 10); // truncate to microseconds
}
} // namespace winapi
//! Create a time object from an initialized FILETIME struct.
/*!
* Create a time object from an initialized FILETIME struct.
@@ -36,7 +119,7 @@ namespace date_time {
*
* \note The function is templated on the FILETIME type, so that
* it can be used with both native FILETIME and the ad-hoc
* boost::detail::winapi::FILETIME_ type.
* boost::date_time::winapi::file_time type.
*/
template< typename TimeT, typename FileTimeT >
inline
@@ -49,17 +132,20 @@ TimeT time_from_ftime(const FileTimeT& ft)
// https://svn.boost.org/trac/boost/ticket/2523
// Since this function can be called with arbitrary times, including ones that
// are before 1970-Jan-01, we'll have to cast the time a bit differently,
// than it is done in the microsec_clock::file_time_to_microseconds function. This allows to
// than it is done in the file_time_to_microseconds function. This allows to
// avoid integer wrapping for dates before 1970-Jan-01.
union {
FileTimeT as_file_time;
uint64_t as_integer; // 100-nanos since 1601-Jan-01
} caster;
caster.as_file_time = ft;
// 100-nanos since 1601-Jan-01
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) // 100-nanoseconds since the last second
uint64_t sec = caster.as_integer / 10000000UL;
uint32_t sub_sec = (caster.as_integer % 10000000UL) // 100-nanoseconds since the last second
#if !defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG)
/ 10U; // microseconds since the last second
/ 10; // microseconds since the last second
#else
* 100U; // nanoseconds since the last second
* 100; // nanoseconds since the last second
#endif
// split sec into usable chunks: days, hours, minutes, & seconds
-42
View File
@@ -1,42 +0,0 @@
#ifndef _BOOST_DATE_TIME_FIND_MATCH_HPP___
#define _BOOST_DATE_TIME_FIND_MATCH_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$
*/
#include <string>
namespace boost {
namespace date_time {
//! Find index of a string in either of 2 arrays
/*! find_match searches both arrays for a match to 's'. Both arrays
* must contain 'size' elements. The index of the match is returned.
* If no match is found, 'size' is returned.
* Ex. "Jan" returns 0, "Dec" returns 11, "Tue" returns 2.
* 'size' can be sent in with: (greg_month::max)() (which 12),
* (greg_weekday::max)() + 1 (which is 7) or date_time::NumSpecialValues */
template<class charT>
short find_match(const charT* const* short_names,
const charT* const* long_names,
short size,
const std::basic_string<charT>& s) {
for(short i = 0; i < size; ++i){
if(short_names[i] == s || long_names[i] == s){
return i;
}
}
return size; // not-found, return a value out of range
}
} } //namespace date_time
#endif
+124 -105
View File
@@ -3,7 +3,7 @@
#define DATE_TIME_FORMAT_DATE_PARSER_HPP__
/* Copyright (c) 2004-2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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
@@ -32,11 +32,11 @@ namespace std {
}
#endif
namespace boost { namespace date_time {
//! Helper function for parsing fixed length strings into integers
/*! Will consume 'length' number of characters from stream. Consumed
* character are transfered to parse_match_result struct.
* Returns '-1' if no number can be parsed or incorrect number of
/*! Will consume 'length' number of characters from stream. Consumed
* character are transfered to parse_match_result struct.
* Returns '-1' if no number can be parsed or incorrect number of
* digits in stream. */
template<typename int_type, typename charT>
inline
@@ -50,12 +50,12 @@ fixed_string_to_int(std::istreambuf_iterator<charT>& itr,
//typedef std::basic_string<charT> string_type;
unsigned int j = 0;
//string_type s;
while (j < length && itr != stream_end &&
while (j < length && itr != stream_end &&
(std::isdigit(*itr) || *itr == fill_char)) {
if(*itr == fill_char) {
/* Since a fill_char can be anything, we convert it to a zero.
/* Since a fill_char can be anything, we convert it to a zero.
* lexical_cast will behave predictably when zero is used as fill. */
mr.cache += ('0');
mr.cache += ('0');
}
else {
mr.cache += (*itr);
@@ -63,7 +63,7 @@ fixed_string_to_int(std::istreambuf_iterator<charT>& itr,
itr++;
j++;
}
int_type i = static_cast<int_type>(-1);
int_type i = -1;
// mr.cache will hold leading zeros. size() tells us when input is too short.
if(mr.cache.size() < length) {
return i;
@@ -77,9 +77,9 @@ fixed_string_to_int(std::istreambuf_iterator<charT>& itr,
}
//! Helper function for parsing fixed length strings into integers
/*! Will consume 'length' number of characters from stream. Consumed
* character are transfered to parse_match_result struct.
* Returns '-1' if no number can be parsed or incorrect number of
/*! Will consume 'length' number of characters from stream. Consumed
* character are transfered to parse_match_result struct.
* Returns '-1' if no number can be parsed or incorrect number of
* digits in stream. */
template<typename int_type, typename charT>
inline
@@ -93,8 +93,8 @@ fixed_string_to_int(std::istreambuf_iterator<charT>& itr,
}
//! Helper function for parsing varied length strings into integers
/*! Will consume 'max_length' characters from stream only if those
* characters are digits. Returns '-1' if no number can be parsed.
/*! Will consume 'max_length' characters from stream only if those
* characters are digits. Returns '-1' if no number can be parsed.
* Will not parse a number preceeded by a '+' or '-'. */
template<typename int_type, typename charT>
inline
@@ -111,7 +111,7 @@ var_string_to_int(std::istreambuf_iterator<charT>& itr,
++itr;
++j;
}
int_type i = static_cast<int_type>(-1);
int_type i = -1;
if(!s.empty()) {
i = boost::lexical_cast<int_type>(s);
}
@@ -133,7 +133,7 @@ var_string_to_int(std::istreambuf_iterator<charT>& itr,
- %W - Week number 00 to 53 where Monday is first day of week 1
- %x - facet default date representation
- %y - Year without the century - eg: 04 for 2004
- %Y - Year with century
- %Y - Year with century
The weekday specifiers (%a and %A) do not add to the date construction,
but they provide a way to skip over the weekday names for formats that
@@ -142,7 +142,7 @@ var_string_to_int(std::istreambuf_iterator<charT>& itr,
todo -- Another interesting feature that this approach could provide is
an option to fill in any missing fields with the current values
from the clock. So if you have %m-%d the parser would detect
the missing year value and fill it in using the clock.
the missing year value and fill it in using the clock.
todo -- What to do with the %x. %x in the classic facet is just bad...
@@ -166,7 +166,7 @@ class format_date_parser
typedef std::vector<std::basic_string<charT> > input_collection_type;
// TODO sv_parser uses its default constructor - write the others
format_date_parser(const string_type& format_str,
const input_collection_type& month_short_names,
const input_collection_type& month_long_names,
@@ -178,7 +178,7 @@ class format_date_parser
m_weekday_short_names(weekday_short_names),
m_weekday_long_names(weekday_long_names)
{}
format_date_parser(const string_type& format_str,
const std::locale& locale) :
m_format(format_str),
@@ -196,7 +196,7 @@ class format_date_parser
this->m_weekday_short_names = fdp.m_weekday_short_names;
this->m_weekday_long_names = fdp.m_weekday_long_names;
}
string_type format() const
{
return m_format;
@@ -225,7 +225,7 @@ class format_date_parser
}
date_type
parse_date(const string_type& value,
parse_date(const string_type& value,
const string_type& format_str,
const special_values_parser<date_type,charT>& sv_parser) const
{
@@ -236,49 +236,49 @@ class format_date_parser
}
date_type
parse_date(std::istreambuf_iterator<charT>& sitr,
parse_date(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
const special_values_parser<date_type,charT>& sv_parser) const
{
return parse_date(sitr, stream_end, m_format, sv_parser);
}
/*! Of all the objects that the format_date_parser can parse, only a
* date can be a special value. Therefore, only parse_date checks
/*! Of all the objects that the format_date_parser can parse, only a
* date can be a special value. Therefore, only parse_date checks
* for special_values. */
date_type
parse_date(std::istreambuf_iterator<charT>& sitr,
parse_date(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str,
const special_values_parser<date_type,charT>& sv_parser) const
{
bool use_current_char = false;
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
charT current_char = *sitr;
short year(0), month(0), day(0), day_of_year(0);// wkday(0);
/* Initialized the following to their minimum values. These intermediate
* objects are used so we get specific exceptions when part of the input
* is unparsable.
short year(0), month(0), day(0), day_of_year(0);// wkday(0);
/* Initialized the following to their minimum values. These intermediate
* objects are used so we get specific exceptions when part of the input
* is unparsable.
* Ex: "205-Jan-15" will throw a bad_year, "2005-Jsn-15"- bad_month, etc.*/
year_type t_year(1400);
month_type t_month(1);
day_type t_day(1);
day_of_week_type wkday(0);
const_itr itr(format_str.begin());
while (itr != format_str.end() && (sitr != stream_end)) {
if (*itr == '%') {
if ( ++itr == format_str.end())
break;
itr++;
if (*itr != '%') {
switch(*itr) {
case 'a':
case 'a':
{
//this value is just throw away. It could be used for
//error checking potentially, but it isn't helpful in
//error checking potentially, but it isn't helpful in
//actually constructing the date - we just need to get it
//out of the stream
match_results mr = m_weekday_short_names.match(sitr, stream_end);
@@ -290,14 +290,15 @@ class format_date_parser
}
wkday = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'A':
case 'A':
{
//this value is just throw away. It could be used for
//error checking potentially, but it isn't helpful in
//error checking potentially, but it isn't helpful in
//actually constructing the date - we just need to get it
//out of the stream
match_results mr = m_weekday_long_names.match(sitr, stream_end);
@@ -309,11 +310,12 @@ class format_date_parser
}
wkday = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'b':
case 'b':
{
match_results mr = m_month_short_names.match(sitr, stream_end);
if(mr.current_match == match_results::PARSE_ERROR) {
@@ -324,11 +326,12 @@ class format_date_parser
}
t_month = month_type(mr.current_match);
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'B':
case 'B':
{
match_results mr = m_month_long_names.match(sitr, stream_end);
if(mr.current_match == match_results::PARSE_ERROR) {
@@ -339,11 +342,12 @@ class format_date_parser
}
t_month = month_type(mr.current_match);
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'd':
case 'd':
{
match_results mr;
day = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 2);
@@ -355,7 +359,7 @@ class format_date_parser
t_day = day_type(day);
break;
}
case 'e':
case 'e':
{
match_results mr;
day = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 2, ' ');
@@ -367,7 +371,7 @@ class format_date_parser
t_day = day_type(day);
break;
}
case 'j':
case 'j':
{
match_results mr;
day_of_year = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 3);
@@ -381,7 +385,7 @@ class format_date_parser
t_day_of_year = day_of_year_type(day_of_year);
break;
}
case 'm':
case 'm':
{
match_results mr;
month = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 2);
@@ -393,7 +397,7 @@ class format_date_parser
t_month = month_type(month);
break;
}
case 'Y':
case 'Y':
{
match_results mr;
year = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 4);
@@ -405,7 +409,7 @@ class format_date_parser
t_year = year_type(year);
break;
}
case 'y':
case 'y':
{
match_results mr;
year = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 2);
@@ -420,135 +424,139 @@ class format_date_parser
}
default:
{} //ignore those we don't understand
}//switch
}
else { // itr == '%', second consecutive
sitr++;
}
itr++; //advance past format specifier
}
else { //skip past chars in format and in buffer
itr++;
if (use_current_char) {
use_current_char = false;
current_char = *sitr;
}
else {
sitr++;
}
}
}
if (day_of_year > 0) {
date_type d(static_cast<unsigned short>(year-1),12,31); //end of prior year
return d + duration_type(day_of_year);
}
return date_type(t_year, t_month, t_day); // exceptions were thrown earlier
// if input was no good
return date_type(t_year, t_month, t_day); // exceptions were thrown earlier
// if input was no good
}
//! Throws bad_month if unable to parse
month_type
parse_month(std::istreambuf_iterator<charT>& sitr,
parse_month(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str) const
{
match_results mr;
return parse_month(sitr, stream_end, format_str, mr);
}
//! Throws bad_month if unable to parse
month_type
parse_month(std::istreambuf_iterator<charT>& sitr,
parse_month(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str,
match_results& mr) const
{
bool use_current_char = false;
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
charT current_char = *sitr;
short month(0);
const_itr itr(format_str.begin());
while (itr != format_str.end() && (sitr != stream_end)) {
if (*itr == '%') {
if ( ++itr == format_str.end())
break;
itr++;
if (*itr != '%') {
switch(*itr) {
case 'b':
case 'b':
{
mr = m_month_short_names.match(sitr, stream_end);
month = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'B':
case 'B':
{
mr = m_month_long_names.match(sitr, stream_end);
month = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'm':
case 'm':
{
month = var_string_to_int<short, charT>(sitr, stream_end, 2);
// var_string_to_int returns -1 if parse failed. That will
// var_string_to_int returns -1 if parse failed. That will
// cause a bad_month exception to be thrown so we do nothing here
break;
}
default:
{} //ignore those we don't understand
}//switch
}
else { // itr == '%', second consecutive
sitr++;
}
itr++; //advance past format specifier
}
else { //skip past chars in format and in buffer
itr++;
if (use_current_char) {
use_current_char = false;
current_char = *sitr;
}
else {
sitr++;
}
}
}
return month_type(month); // throws bad_month exception when values are zero
}
//! Expects 1 or 2 digits 1-31. Throws bad_day_of_month if unable to parse
day_type
parse_var_day_of_month(std::istreambuf_iterator<charT>& sitr,
parse_var_day_of_month(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
return day_type(var_string_to_int<short, charT>(sitr, stream_end, 2));
}
//! Expects 2 digits 01-31. Throws bad_day_of_month if unable to parse
day_type
parse_day_of_month(std::istreambuf_iterator<charT>& sitr,
parse_day_of_month(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
//return day_type(var_string_to_int<short, charT>(sitr, stream_end, 2));
match_results mr;
@@ -556,7 +564,7 @@ class format_date_parser
}
day_of_week_type
parse_weekday(std::istreambuf_iterator<charT>& sitr,
parse_weekday(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str) const
{
@@ -564,47 +572,49 @@ class format_date_parser
return parse_weekday(sitr, stream_end, format_str, mr);
}
day_of_week_type
parse_weekday(std::istreambuf_iterator<charT>& sitr,
parse_weekday(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str,
match_results& mr) const
{
bool use_current_char = false;
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
charT current_char = *sitr;
short wkday(0);
const_itr itr(format_str.begin());
while (itr != format_str.end() && (sitr != stream_end)) {
if (*itr == '%') {
if ( ++itr == format_str.end())
break;
itr++;
if (*itr != '%') {
switch(*itr) {
case 'a':
case 'a':
{
//this value is just throw away. It could be used for
//error checking potentially, but it isn't helpful in
//error checking potentially, but it isn't helpful in
//actually constructing the date - we just need to get it
//out of the stream
mr = m_weekday_short_names.match(sitr, stream_end);
wkday = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'A':
case 'A':
{
//this value is just throw away. It could be used for
//error checking potentially, but it isn't helpful in
//error checking potentially, but it isn't helpful in
//actually constructing the date - we just need to get it
//out of the stream
mr = m_weekday_long_names.match(sitr, stream_end);
wkday = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
@@ -617,34 +627,35 @@ class format_date_parser
}
default:
{} //ignore those we don't understand
}//switch
}
else { // itr == '%', second consecutive
sitr++;
}
itr++; //advance past format specifier
}
else { //skip past chars in format and in buffer
itr++;
if (use_current_char) {
use_current_char = false;
current_char = *sitr;
}
else {
sitr++;
}
}
}
return day_of_week_type(wkday); // throws bad_day_of_month exception
return day_of_week_type(wkday); // throws bad_day_of_month exception
// when values are zero
}
//! throws bad_year if unable to parse
year_type
parse_year(std::istreambuf_iterator<charT>& sitr,
parse_year(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str) const
{
@@ -654,21 +665,23 @@ class format_date_parser
//! throws bad_year if unable to parse
year_type
parse_year(std::istreambuf_iterator<charT>& sitr,
parse_year(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str,
match_results& mr) const
{
bool use_current_char = false;
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
charT current_char = *sitr;
unsigned short year(0);
const_itr itr(format_str.begin());
while (itr != format_str.end() && (sitr != stream_end)) {
if (*itr == '%') {
if ( ++itr == format_str.end())
break;
itr++;
if (*itr != '%') {
//match_results mr;
switch(*itr) {
@@ -687,26 +700,32 @@ class format_date_parser
}
default:
{} //ignore those we don't understand
}//switch
}
else { // itr == '%', second consecutive
sitr++;
}
itr++; //advance past format specifier
}
else { //skip past chars in format and in buffer
itr++;
sitr++;
if (use_current_char) {
use_current_char = false;
current_char = *sitr;
}
else {
sitr++;
}
}
}
return year_type(year); // throws bad_year exception when values are zero
}
private:
string_type m_format;
parse_tree_type m_month_short_names;
@@ -65,7 +65,7 @@ namespace gregorian {
std::basic_string<charT> s(date_time::date_formatter<date,date_time::iso_format<charT>,charT>::date_to_string(d.begin()));
return s + sep + date_time::date_formatter<date,date_time::iso_format<charT>,charT>::date_to_string(d.last());
}
//! Date period to ISO 8601 standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
//! Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
/*!\ingroup date_format
*/
inline std::string to_iso_string(const date_period& d) {
@@ -78,7 +78,7 @@ namespace gregorian {
inline std::basic_string<charT> to_iso_extended_string_type(const date& d) {
return date_time::date_formatter<date,date_time::iso_extended_format<charT>,charT>::date_to_string(d);
}
//! Convert to ISO 8601 extended format string CCYY-MM-DD. Example 2002-12-31
//! Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31
/*!\ingroup date_format
*/
inline std::string to_iso_extended_string(const date& d) {
@@ -90,7 +90,7 @@ namespace gregorian {
inline std::basic_string<charT> to_iso_string_type(const date& d) {
return date_time::date_formatter<date,date_time::iso_format<charT>,charT>::date_to_string(d);
}
//! Convert to ISO 8601 standard string YYYYMMDD. Example: 20021231
//! Convert to iso standard string YYYYMMDD. Example: 20021231
/*!\ingroup date_format
*/
inline std::string to_iso_string(const date& d) {
@@ -35,7 +35,7 @@ namespace gregorian {
return std::string("[" + d1 + "/" + d2 + "]");
}
//! Date period to ISO 8601 standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
//! Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
/*!\ingroup date_format
*/
inline std::string to_iso_string(const date_period& d) {
@@ -44,14 +44,14 @@ namespace gregorian {
}
//! Convert to ISO 8601 extended format string CCYY-MM-DD. Example 2002-12-31
//! Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31
/*!\ingroup date_format
*/
inline std::string to_iso_extended_string(const date& d) {
return date_time::date_formatter<date,date_time::iso_extended_format<char> >::date_to_string(d);
}
//! Convert to ISO 8601 standard string YYYYMMDD. Example: 20021231
//! Convert to iso standard string YYYYMMDD. Example: 20021231
/*!\ingroup date_format
*/
inline std::string to_iso_string(const date& d) {
@@ -10,7 +10,6 @@
*/
#include <boost/cstdint.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/gregorian/greg_weekday.hpp>
#include <boost/date_time/gregorian/greg_day_of_year.hpp>
#include <boost/date_time/gregorian_calendar.hpp>
@@ -24,7 +23,7 @@ namespace gregorian {
typedef date_time::int_adapter<uint32_t> fancy_date_rep;
//! Gregorian calendar for this implementation, hard work in the base
class BOOST_SYMBOL_VISIBLE gregorian_calendar :
class gregorian_calendar :
public date_time::gregorian_calendar_base<greg_year_month_day, fancy_date_rep::int_type> {
public:
//! Type to hold a weekday (eg: Sunday, Monday,...)
+28 -36
View File
@@ -1,7 +1,7 @@
#ifndef GREG_DATE_HPP___
#define GREG_DATE_HPP___
/* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003 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)
@@ -10,7 +10,6 @@
*/
#include <boost/throw_exception.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/date.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/gregorian/greg_calendar.hpp>
@@ -35,7 +34,7 @@ namespace gregorian {
supported.
\ingroup date_basics
*/
class BOOST_SYMBOL_VISIBLE date : public date_time::date<date, gregorian_calendar, date_duration>
class date : public date_time::date<date, gregorian_calendar, date_duration>
{
public:
typedef gregorian_calendar::year_type year_type;
@@ -48,12 +47,12 @@ namespace gregorian {
typedef date_duration duration_type;
#if !defined(DATE_TIME_NO_DEFAULT_CONSTRUCTOR)
//! Default constructor constructs with not_a_date_time
BOOST_CXX14_CONSTEXPR date():
date():
date_time::date<date, gregorian_calendar, date_duration>(date_rep_type::from_special(not_a_date_time))
{}
#endif // DATE_TIME_NO_DEFAULT_CONSTRUCTOR
//! Main constructor with year, month, day
BOOST_CXX14_CONSTEXPR date(year_type y, month_type m, day_type d)
date(year_type y, month_type m, day_type d)
: date_time::date<date, gregorian_calendar, date_duration>(y, m, d)
{
if (gregorian_calendar::end_of_month_day(y, m) < d) {
@@ -61,80 +60,73 @@ namespace gregorian {
}
}
//! Constructor from a ymd_type structure
BOOST_CXX14_CONSTEXPR explicit date(const ymd_type& ymd)
explicit date(const ymd_type& ymd)
: date_time::date<date, gregorian_calendar, date_duration>(ymd)
{}
//! Needed copy constructor
BOOST_CXX14_CONSTEXPR explicit date(const date_int_type& rhs):
explicit date(const date_int_type& rhs):
date_time::date<date,gregorian_calendar, date_duration>(rhs)
{}
//! Needed copy constructor
BOOST_CXX14_CONSTEXPR explicit date(date_rep_type rhs):
explicit date(date_rep_type rhs):
date_time::date<date,gregorian_calendar, date_duration>(rhs)
{}
//! Constructor for infinities, not a date, max and min date
BOOST_CXX14_CONSTEXPR explicit date(special_values sv):
date_time::date<date, gregorian_calendar, date_duration>(from_special_adjusted(sv))
{}
explicit date(special_values sv):
date_time::date<date, gregorian_calendar, date_duration>(date_rep_type::from_special(sv))
{
if (sv == min_date_time)
{
*this = date(1400, 1, 1);
}
if (sv == max_date_time)
{
*this = date(9999, 12, 31);
}
}
//!Return the Julian Day number for the date.
BOOST_CXX14_CONSTEXPR date_int_type julian_day() const
date_int_type julian_day() const
{
ymd_type ymd = year_month_day();
return gregorian_calendar::julian_day_number(ymd);
}
//!Return the day of year 1..365 or 1..366 (for leap year)
BOOST_CXX14_CONSTEXPR day_of_year_type day_of_year() const
day_of_year_type day_of_year() const
{
date start_of_year(year(), 1, 1);
unsigned short doy = static_cast<unsigned short>((*this-start_of_year).days() + 1);
return day_of_year_type(doy);
}
//!Return the Modified Julian Day number for the date.
BOOST_CXX14_CONSTEXPR date_int_type modjulian_day() const
date_int_type modjulian_day() const
{
ymd_type ymd = year_month_day();
return gregorian_calendar::modjulian_day_number(ymd);
}
//!Return the ISO 8601 week number 1..53
BOOST_CXX14_CONSTEXPR int week_number() const
//!Return the iso 8601 week number 1..53
int week_number() const
{
ymd_type ymd = year_month_day();
return gregorian_calendar::week_number(ymd);
}
//! Return the day number from the calendar
BOOST_CXX14_CONSTEXPR date_int_type day_number() const
date_int_type day_number() const
{
return days_;
}
//! Return the last day of the current month
BOOST_CXX14_CONSTEXPR date end_of_month() const
date end_of_month() const
{
ymd_type ymd = year_month_day();
unsigned short eom_day = gregorian_calendar::end_of_month_day(ymd.year, ymd.month);
short eom_day = gregorian_calendar::end_of_month_day(ymd.year, ymd.month);
return date(ymd.year, ymd.month, eom_day);
}
friend BOOST_CXX14_CONSTEXPR
bool operator==(const date& lhs, const date& rhs);
private:
BOOST_CXX14_CONSTEXPR date_rep_type from_special_adjusted(special_values sv)
{
switch (sv)
{
case min_date_time: return gregorian_calendar::day_number(ymd_type(1400, 1, 1));
case max_date_time: return gregorian_calendar::day_number(ymd_type(9999, 12, 31));
default: return date_rep_type::from_special(sv);
}
}
};
inline BOOST_CXX14_CONSTEXPR
bool operator==(const date& lhs, const date& rhs)
{
return lhs.days_ == rhs.days_;
}
} } //namespace gregorian
@@ -1,7 +1,7 @@
#ifndef GREG_DAY_HPP___
#define GREG_DAY_HPP___
/* Copyright (c) 2002,2003,2020 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003 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)
@@ -9,8 +9,7 @@
* $Date$
*/
#include <boost/date_time/constrained_value.hpp>
#include <boost/date_time/compiler_config.hpp>
#include "boost/date_time/constrained_value.hpp"
#include <stdexcept>
#include <string>
@@ -18,7 +17,7 @@ namespace boost {
namespace gregorian {
//! Exception type for gregorian day of month (1..31)
struct BOOST_SYMBOL_VISIBLE bad_day_of_month : public std::out_of_range
struct bad_day_of_month : public std::out_of_range
{
bad_day_of_month() :
std::out_of_range(std::string("Day of month value is out of range 1..31"))
@@ -40,11 +39,11 @@ namespace gregorian {
is automatically range checked so values outside of the range 1-31
will cause a bad_day_of_month exception
*/
class BOOST_SYMBOL_VISIBLE greg_day : public greg_day_rep {
class greg_day : public greg_day_rep {
public:
BOOST_CXX14_CONSTEXPR greg_day(value_type day_of_month) : greg_day_rep(day_of_month) {}
BOOST_CXX14_CONSTEXPR value_type as_number() const {return value_;}
BOOST_CXX14_CONSTEXPR operator value_type() const {return value_;}
greg_day(unsigned short day_of_month) : greg_day_rep(day_of_month) {}
unsigned short as_number() const {return value_;}
operator unsigned short() const {return value_;}
private:
};
@@ -9,8 +9,7 @@
* $Date$
*/
#include <boost/date_time/constrained_value.hpp>
#include <boost/date_time/compiler_config.hpp>
#include "boost/date_time/constrained_value.hpp"
#include <stdexcept>
#include <string>
@@ -18,7 +17,7 @@ namespace boost {
namespace gregorian {
//! Exception type for day of year (1..366)
struct BOOST_SYMBOL_VISIBLE bad_day_of_year : public std::out_of_range
struct bad_day_of_year : public std::out_of_range
{
bad_day_of_year() :
std::out_of_range(std::string("Day of year value is out of range 1..366"))
@@ -1,7 +1,7 @@
#ifndef GREG_DURATION_HPP___
#define GREG_DURATION_HPP___
/* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003 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)
@@ -9,7 +9,6 @@
* $Date$
*/
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/date_duration.hpp>
#include <boost/date_time/int_adapter.hpp>
#include <boost/date_time/special_defs.hpp>
@@ -23,7 +22,7 @@ namespace gregorian {
//! Durations in days for gregorian system
/*! \ingroup date_basics
*/
class BOOST_SYMBOL_VISIBLE date_duration :
class date_duration :
public boost::date_time::date_duration< date_duration_rep >
{
typedef boost::date_time::date_duration< date_duration_rep > base_type;
@@ -32,15 +31,16 @@ namespace gregorian {
typedef base_type::duration_rep duration_rep;
//! Construct from a day count
BOOST_CXX14_CONSTEXPR explicit
date_duration(duration_rep day_count = 0) : base_type(day_count) {}
explicit date_duration(duration_rep day_count = 0) : base_type(day_count) {}
//! construct from special_values
BOOST_CXX14_CONSTEXPR
date_duration(date_time::special_values sv) : base_type(sv) {}
//! Copy constructor
date_duration(const date_duration& other) : base_type(static_cast< base_type const& >(other))
{}
//! Construct from another date_duration
BOOST_CXX14_CONSTEXPR
date_duration(const base_type& other) : base_type(other)
{}
@@ -48,93 +48,80 @@ namespace gregorian {
// NOTE: Because of date_time::date_duration< T > design choice we don't use Boost.Operators here,
// because we need the class to be a direct base. Either lose EBO, or define operators by hand.
// The latter is more effecient.
BOOST_CXX14_CONSTEXPR bool operator== (const date_duration& rhs) const
bool operator== (const date_duration& rhs) const
{
return base_type::operator== (rhs);
}
BOOST_CXX14_CONSTEXPR bool operator!= (const date_duration& rhs) const
bool operator!= (const date_duration& rhs) const
{
return !operator== (rhs);
}
BOOST_CXX14_CONSTEXPR bool operator< (const date_duration& rhs) const
bool operator< (const date_duration& rhs) const
{
return base_type::operator< (rhs);
}
BOOST_CXX14_CONSTEXPR bool operator> (const date_duration& rhs) const
bool operator> (const date_duration& rhs) const
{
return !(base_type::operator< (rhs) || base_type::operator== (rhs));
}
BOOST_CXX14_CONSTEXPR bool operator<= (const date_duration& rhs) const
bool operator<= (const date_duration& rhs) const
{
return (base_type::operator< (rhs) || base_type::operator== (rhs));
}
BOOST_CXX14_CONSTEXPR bool operator>= (const date_duration& rhs) const
bool operator>= (const date_duration& rhs) const
{
return !base_type::operator< (rhs);
}
//! Subtract another duration -- result is signed
BOOST_CXX14_CONSTEXPR date_duration& operator-= (const date_duration& rhs)
date_duration& operator-= (const date_duration& rhs)
{
base_type::operator-= (rhs);
return *this;
}
BOOST_CXX14_CONSTEXPR friend
date_duration operator- (date_duration rhs, date_duration const& lhs);
//! Add a duration -- result is signed
BOOST_CXX14_CONSTEXPR date_duration& operator+= (const date_duration& rhs)
{
base_type::operator+= (rhs);
return *this;
}
BOOST_CXX14_CONSTEXPR friend
date_duration operator+ (date_duration rhs, date_duration const& lhs);
//! unary- Allows for dd = -date_duration(2); -> dd == -2
BOOST_CXX14_CONSTEXPR date_duration operator- ()const
{
return date_duration(get_rep() * (-1));
}
//! Division operations on a duration with an integer.
BOOST_CXX14_CONSTEXPR date_duration& operator/= (int divisor)
{
base_type::operator/= (divisor);
return *this;
}
BOOST_CXX14_CONSTEXPR friend date_duration operator/ (date_duration rhs, int lhs);
//! Returns the smallest duration -- used by to calculate 'end'
static BOOST_CXX14_CONSTEXPR date_duration unit()
{
return date_duration(base_type::unit().get_rep());
}
};
inline BOOST_CXX14_CONSTEXPR
date_duration operator- (date_duration rhs, date_duration const& lhs)
friend date_duration operator- (date_duration rhs, date_duration const& lhs)
{
rhs -= lhs;
return rhs;
}
inline BOOST_CXX14_CONSTEXPR
date_duration operator+ (date_duration rhs, date_duration const& lhs)
//! Add a duration -- result is signed
date_duration& operator+= (const date_duration& rhs)
{
base_type::operator+= (rhs);
return *this;
}
friend date_duration operator+ (date_duration rhs, date_duration const& lhs)
{
rhs += lhs;
return rhs;
}
inline BOOST_CXX14_CONSTEXPR date_duration operator/ (date_duration rhs, int lhs)
//! unary- Allows for dd = -date_duration(2); -> dd == -2
date_duration operator- ()const
{
return date_duration(get_rep() * (-1));
}
//! Division operations on a duration with an integer.
date_duration& operator/= (int divisor)
{
base_type::operator/= (divisor);
return *this;
}
friend date_duration operator/ (date_duration rhs, int lhs)
{
rhs /= lhs;
return rhs;
}
//! Returns the smallest duration -- used by to calculate 'end'
static date_duration unit()
{
return date_duration(base_type::unit().get_rep());
}
};
//! Shorthand for date_duration
typedef date_duration days;
@@ -1,6 +1,6 @@
#ifndef GREG_DURATION_TYPES_HPP___
#define GREG_DURATION_TYPES_HPP___
/* Copyright (c) 2004 CrystalClear Software, Inc.
* Subject to Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
@@ -9,7 +9,6 @@
*/
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/gregorian/greg_date.hpp>
#include <boost/date_time/int_adapter.hpp>
#include <boost/date_time/adjust_functors.hpp>
@@ -20,7 +19,7 @@ namespace boost {
namespace gregorian {
//! config struct for additional duration types (ie months_duration<> & years_duration<>)
struct BOOST_SYMBOL_VISIBLE greg_durations_config {
struct greg_durations_config {
typedef date date_type;
typedef date_time::int_adapter<int> int_rep;
typedef date_time::month_functor<date_type> month_adjustor_type;
@@ -29,11 +28,11 @@ namespace gregorian {
typedef date_time::months_duration<greg_durations_config> months;
typedef date_time::years_duration<greg_durations_config> years;
class BOOST_SYMBOL_VISIBLE weeks_duration : public date_duration {
class weeks_duration : public date_duration {
public:
BOOST_CXX14_CONSTEXPR weeks_duration(duration_rep w)
weeks_duration(duration_rep w)
: date_duration(w * 7) {}
BOOST_CXX14_CONSTEXPR weeks_duration(date_time::special_values sv)
weeks_duration(date_time::special_values sv)
: date_duration(sv) {}
};
@@ -9,11 +9,9 @@
* $Date$
*/
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/date_formatting_locales.hpp> // sets BOOST_DATE_TIME_NO_LOCALE
#include <boost/date_time/gregorian/parsers.hpp>
#include <boost/io/ios_state.hpp>
#include "boost/date_time/gregorian/gregorian_types.hpp"
#include "boost/date_time/date_formatting_locales.hpp" // sets BOOST_DATE_TIME_NO_LOCALE
#include "boost/date_time/gregorian/parsers.hpp"
//This file is basically commented out if locales are not supported
#ifndef BOOST_DATE_TIME_NO_LOCALE
@@ -28,7 +26,7 @@ namespace boost {
namespace gregorian {
//! Configuration of the output facet template
struct BOOST_SYMBOL_VISIBLE greg_facet_config
struct greg_facet_config
{
typedef boost::gregorian::greg_month month_type;
typedef boost::date_time::special_values special_value_enum;
@@ -76,9 +74,9 @@ namespace gregorian {
greg_month_formatter::format_month(m, os, f);
}
else { // default to numeric
boost::io::basic_ios_fill_saver<charT> ifs(os);
os << std::setw(2) << std::setfill(os.widen('0')) << m.as_number();
else { //default to numeric
charT fill_char = '0';
os << std::setw(2) << std::setfill(fill_char) << m.as_number();
}
return os;
@@ -99,7 +97,7 @@ namespace gregorian {
std::locale locale = os.getloc();
if (std::has_facet<facet_def>(locale)) {
const facet_def& f = std::use_facet<facet_def>(locale);
greg_weekday_formatter::format_weekday(wd, os, f, true);
greg_weekday_formatter::format_weekday(wd.as_enum(), os, f, true);
}
else { //default to short English string eg: Sun, Mon, Tue, Wed...
os << wd.as_short_string();
@@ -143,8 +141,7 @@ namespace gregorian {
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const partial_date& pd)
{
boost::io::basic_ios_fill_saver<charT> ifs(os);
os << std::setw(2) << std::setfill(os.widen('0')) << pd.day() << ' '
os << std::setw(2) << std::setfill('0') << pd.day() << ' '
<< pd.month().as_short_string() ;
return os;
}
@@ -217,6 +214,8 @@ namespace gregorian {
std::basic_istream<charT>& operator>>(std::basic_istream<charT>& is, date& d)
{
std::istream_iterator<std::basic_string<charT>, charT> beg(is), eos;
typedef boost::date_time::all_date_names_put<greg_facet_config, charT> facet_def;
d = from_stream(beg, eos);
return is;
}
@@ -293,17 +292,7 @@ namespace gregorian {
* names as a default. */
catch(std::bad_cast&){
charT a = '\0';
#if defined(BOOST_NO_CXX11_SMART_PTR)
std::auto_ptr< const facet_def > f(create_facet_def(a));
#else
std::unique_ptr< const facet_def > f(create_facet_def(a));
#endif
num = date_time::find_match(f->get_short_month_names(),
f->get_long_month_names(),
(greg_month::max)(), s); // greg_month spans 1..12, so max returns the array size,
@@ -345,17 +334,7 @@ namespace gregorian {
* names as a default. */
catch(std::bad_cast&){
charT a = '\0';
#if defined(BOOST_NO_CXX11_SMART_PTR)
std::auto_ptr< const facet_def > f(create_facet_def(a));
#else
std::unique_ptr< const facet_def > f(create_facet_def(a));
#endif
num = date_time::find_match(f->get_short_weekday_names(),
f->get_long_weekday_names(),
(greg_weekday::max)() + 1, s); // greg_weekday spans 0..6, so increment is needed
@@ -368,7 +347,8 @@ namespace gregorian {
} } //namespace gregorian
#endif
#endif
#endif
@@ -1,7 +1,7 @@
#ifndef GREG_MONTH_HPP___
#define GREG_MONTH_HPP___
/* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003 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)
@@ -9,11 +9,15 @@
* $Date$
*/
#include <boost/date_time/constrained_value.hpp>
#include <boost/date_time/date_defs.hpp>
#include <boost/date_time/compiler_config.hpp>
#include "boost/date_time/constrained_value.hpp"
#include "boost/date_time/date_defs.hpp"
#include "boost/shared_ptr.hpp"
#include "boost/date_time/compiler_config.hpp"
#include <stdexcept>
#include <string>
#include <map>
#include <algorithm>
#include <cctype>
namespace boost {
namespace gregorian {
@@ -35,9 +39,9 @@ namespace gregorian {
using date_time::Dec;
using date_time::NotAMonth;
using date_time::NumMonths;
//! Exception thrown if a greg_month is constructed with a value out of range
struct BOOST_SYMBOL_VISIBLE bad_month : public std::out_of_range
struct bad_month : public std::out_of_range
{
bad_month() : std::out_of_range(std::string("Month number is out of range 1..12")) {}
};
@@ -46,65 +50,31 @@ namespace gregorian {
//! A constrained range that implements the gregorian_month rules
typedef CV::constrained_value<greg_month_policies> greg_month_rep;
//! Wrapper class to represent months in gregorian based calendar
class BOOST_SYMBOL_VISIBLE greg_month : public greg_month_rep {
class BOOST_DATE_TIME_DECL greg_month : public greg_month_rep {
public:
typedef date_time::months_of_year month_enum;
typedef std::map<std::string, unsigned short> month_map_type;
typedef boost::shared_ptr<month_map_type> month_map_ptr_type;
//! Construct a month from the months_of_year enumeration
BOOST_CXX14_CONSTEXPR greg_month(month_enum theMonth) :
greg_month(month_enum theMonth) :
greg_month_rep(static_cast<greg_month_rep::value_type>(theMonth)) {}
//! Construct from a short value
BOOST_CXX14_CONSTEXPR greg_month(value_type theMonth) : greg_month_rep(theMonth) {}
greg_month(unsigned short theMonth) : greg_month_rep(theMonth) {}
//! Convert the value back to a short
BOOST_CXX14_CONSTEXPR operator value_type() const {return value_;}
operator unsigned short() const {return value_;}
//! Returns month as number from 1 to 12
BOOST_CXX14_CONSTEXPR value_type as_number() const {return value_;}
BOOST_CXX14_CONSTEXPR month_enum as_enum() const {return static_cast<month_enum>(value_);}
//! Returns 3 char english string for the month ex: Jan, Feb, Mar, Apr
const char*
as_short_string() const
{
static const char* const short_month_names[NumMonths]
= {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec", "NAM"};
return short_month_names[value_-1];
}
//! Returns full name of month as string in english ex: January, February
const char*
as_long_string() const
{
static const char* const long_month_names[NumMonths]
= {"January","February","March","April","May","June","July","August",
"September","October","November","December","NotAMonth"};
return long_month_names[value_-1];
}
unsigned short as_number() const {return value_;}
month_enum as_enum() const {return static_cast<month_enum>(value_);}
const char* as_short_string() const;
const char* as_long_string() const;
#ifndef BOOST_NO_STD_WSTRING
//! Returns 3 wchar_t english string for the month ex: Jan, Feb, Mar, Apr
const wchar_t*
as_short_wstring() const
{
static const wchar_t* const w_short_month_names[NumMonths]
= {L"Jan",L"Feb",L"Mar",L"Apr",L"May",L"Jun",L"Jul",L"Aug",L"Sep",L"Oct",
L"Nov",L"Dec",L"NAM"};
return w_short_month_names[value_-1];
}
//! Returns full name of month as wchar_t string in english ex: January, February
const wchar_t*
as_long_wstring() const
{
static const wchar_t* const w_long_month_names[NumMonths]
= {L"January",L"February",L"March",L"April",L"May",L"June",L"July",L"August",
L"September",L"October",L"November",L"December",L"NotAMonth"};
return w_long_month_names[value_-1];
}
const wchar_t* as_short_wstring() const;
const wchar_t* as_long_wstring() const;
#endif // BOOST_NO_STD_WSTRING
//! Shared pointer to a map of Month strings (Names & Abbrev) & numbers
static month_map_ptr_type get_month_map_ptr();
/* parameterized as_*_string functions are intended to be called
* from a template function: "... as_short_string(charT c='\0');" */
@@ -130,4 +100,6 @@ namespace gregorian {
} } //namespace gregorian
#endif
@@ -11,47 +11,39 @@
#include "boost/date_time/gregorian/gregorian_types.hpp"
#include "boost/date_time/gregorian/parsers.hpp"
#include "boost/core/nvp.hpp"
#include "boost/serialization/split_free.hpp"
#include "boost/serialization/nvp.hpp"
// macros to split serialize functions into save & load functions
// An expanded version is below for gregorian::date
// NOTE: these macros define template functions in the boost::serialization namespace.
// They must be expanded *outside* of any namespace
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration::duration_rep)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_period)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_month)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_day)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_weekday)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::partial_date)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::nth_kday_of_month)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::first_kday_of_month)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::last_kday_of_month)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::first_kday_before)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::first_kday_after)
namespace boost {
namespace gregorian {
std::string to_iso_string(const date&);
}
namespace serialization {
// A macro to split serialize functions into save & load functions.
// It is here to avoid dependency on Boost.Serialization just for the
// BOOST_SERIALIZATION_SPLIT_FREE macro
#define BOOST_DATE_TIME_SPLIT_FREE(T) \
template<class Archive> \
inline void serialize(Archive & ar, \
T & t, \
const unsigned int file_version) \
{ \
split_free(ar, t, file_version); \
}
/*! Method that does serialization for gregorian::date -- splits to load/save
*/
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::date)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::date_duration)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::date_duration::duration_rep)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::date_period)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::greg_year)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::greg_month)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::greg_day)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::greg_weekday)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::partial_date)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::nth_kday_of_month)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::first_kday_of_month)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::last_kday_of_month)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::first_kday_before)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::first_kday_after)
#undef BOOST_DATE_TIME_SPLIT_FREE
template<class Archive>
inline void serialize(Archive & ar,
::boost::gregorian::date & d,
const unsigned int file_version)
{
split_free(ar, d, file_version);
}
//! Function to save gregorian::date objects using serialization lib
/*! Dates are serialized into a string for transport and storage.
@@ -95,7 +87,7 @@ void load(Archive & ar,
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/,
inline void load_construct_data(Archive & ar,
::boost::gregorian::date* dp,
const unsigned int /*file_version*/)
{
@@ -124,7 +116,7 @@ void load(Archive & ar, gregorian::date_duration & dd, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/, gregorian::date_duration* dd,
inline void load_construct_data(Archive & ar, gregorian::date_duration* dd,
const unsigned int /*file_version*/)
{
::new(dd) gregorian::date_duration(gregorian::not_a_date_time);
@@ -150,7 +142,7 @@ void load(Archive & ar, gregorian::date_duration::duration_rep & dr, unsigned in
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/, gregorian::date_duration::duration_rep* dr,
inline void load_construct_data(Archive & ar, gregorian::date_duration::duration_rep* dr,
const unsigned int /*file_version*/)
{
::new(dr) gregorian::date_duration::duration_rep(0);
@@ -186,7 +178,7 @@ void load(Archive & ar, gregorian::date_period& dp, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/, gregorian::date_period* dp,
inline void load_construct_data(Archive & ar, gregorian::date_period* dp,
const unsigned int /*file_version*/)
{
gregorian::date d(gregorian::not_a_date_time);
@@ -194,32 +186,6 @@ inline void load_construct_data(Archive & /*ar*/, gregorian::date_period* dp,
::new(dp) gregorian::date_period(d,dd);
}
/**** greg_year ****/
//! Function to save gregorian::greg_year objects using serialization lib
template<class Archive>
void save(Archive & ar, const gregorian::greg_year& gy,
unsigned int /*version*/)
{
unsigned short us = gy;
ar & make_nvp("greg_year", us);
}
//! Function to load gregorian::greg_year objects using serialization lib
template<class Archive>
void load(Archive & ar, gregorian::greg_year& gy, unsigned int /*version*/)
{
unsigned short us;
ar & make_nvp("greg_year", us);
gy = gregorian::greg_year(us);
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/, gregorian::greg_year* gy,
const unsigned int /*file_version*/)
{
::new(gy) gregorian::greg_year(1900);
}
/**** greg_month ****/
//! Function to save gregorian::greg_month objects using serialization lib
@@ -240,7 +206,7 @@ void load(Archive & ar, gregorian::greg_month& gm, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/, gregorian::greg_month* gm,
inline void load_construct_data(Archive & ar, gregorian::greg_month* gm,
const unsigned int /*file_version*/)
{
::new(gm) gregorian::greg_month(1);
@@ -266,7 +232,7 @@ void load(Archive & ar, gregorian::greg_day& gd, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/, gregorian::greg_day* gd,
inline void load_construct_data(Archive & ar, gregorian::greg_day* gd,
const unsigned int /*file_version*/)
{
::new(gd) gregorian::greg_day(1);
@@ -292,7 +258,7 @@ void load(Archive & ar, gregorian::greg_weekday& gd, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/, gregorian::greg_weekday* gd,
inline void load_construct_data(Archive & ar, gregorian::greg_weekday* gd,
const unsigned int /*file_version*/)
{
::new(gd) gregorian::greg_weekday(1);
@@ -330,7 +296,7 @@ void load(Archive & ar, gregorian::partial_date& pd, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/, gregorian::partial_date* pd,
inline void load_construct_data(Archive & ar, gregorian::partial_date* pd,
const unsigned int /*file_version*/)
{
gregorian::greg_month gm(1);
@@ -373,7 +339,7 @@ void load(Archive & ar, gregorian::nth_kday_of_month& nkd, unsigned int /*versio
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/,
inline void load_construct_data(Archive & ar,
gregorian::nth_kday_of_month* nkd,
const unsigned int /*file_version*/)
{
@@ -413,7 +379,7 @@ void load(Archive & ar, gregorian::first_kday_of_month& fkd, unsigned int /*vers
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/,
inline void load_construct_data(Archive & ar,
gregorian::first_kday_of_month* fkd,
const unsigned int /*file_version*/)
{
@@ -452,7 +418,7 @@ void load(Archive & ar, gregorian::last_kday_of_month& lkd, unsigned int /*versi
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/,
inline void load_construct_data(Archive & ar,
gregorian::last_kday_of_month* lkd,
const unsigned int /*file_version*/)
{
@@ -481,7 +447,7 @@ void load(Archive & ar, gregorian::first_kday_before& fkdb, unsigned int /*versi
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/,
inline void load_construct_data(Archive & ar,
gregorian::first_kday_before* fkdb,
const unsigned int /*file_version*/)
{
@@ -510,7 +476,7 @@ void load(Archive & ar, gregorian::first_kday_after& fkda, unsigned int /*versio
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/,
inline void load_construct_data(Archive & ar,
gregorian::first_kday_after* fkda,
const unsigned int /*file_version*/)
{
@@ -1,7 +1,7 @@
#ifndef GREG_WEEKDAY_HPP___
#define GREG_WEEKDAY_HPP___
/* Copyright (c) 2002,2003,2020 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003 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)
@@ -9,9 +9,9 @@
* $Date$
*/
#include <boost/date_time/constrained_value.hpp>
#include <boost/date_time/date_defs.hpp>
#include <boost/date_time/compiler_config.hpp>
#include "boost/date_time/constrained_value.hpp"
#include "boost/date_time/date_defs.hpp"
#include "boost/date_time/compiler_config.hpp"
#include <stdexcept>
#include <string>
@@ -29,7 +29,7 @@ namespace gregorian {
//! Exception that flags that a weekday number is incorrect
struct BOOST_SYMBOL_VISIBLE bad_weekday : public std::out_of_range
struct bad_weekday : public std::out_of_range
{
bad_weekday() : std::out_of_range(std::string("Weekday is out of range 0..6")) {}
};
@@ -38,55 +38,21 @@ namespace gregorian {
//! Represent a day within a week (range 0==Sun to 6==Sat)
class BOOST_SYMBOL_VISIBLE greg_weekday : public greg_weekday_rep {
class BOOST_DATE_TIME_DECL greg_weekday : public greg_weekday_rep {
public:
typedef boost::date_time::weekdays weekday_enum;
BOOST_CXX14_CONSTEXPR greg_weekday(value_type day_of_week_num) :
greg_weekday(unsigned short day_of_week_num) :
greg_weekday_rep(day_of_week_num)
{}
BOOST_CXX14_CONSTEXPR value_type as_number() const {return value_;}
BOOST_CXX14_CONSTEXPR weekday_enum as_enum() const {return static_cast<weekday_enum>(value_);}
//! Return a 3 digit english string of the day of week (eg: Sun)
const char* as_short_string() const
{
static const char* const short_weekday_names[]
= {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
return short_weekday_names[value_];
}
//! Return a point to a long english string representing day of week
const char* as_long_string() const
{
static const char* const long_weekday_names[]
= {"Sunday","Monday","Tuesday","Wednesday", "Thursday", "Friday", "Saturday"};
return long_weekday_names[value_];
}
unsigned short as_number() const {return value_;}
const char* as_short_string() const;
const char* as_long_string() const;
#ifndef BOOST_NO_STD_WSTRING
//! Return a 3 digit english wchar_t string of the day of week (eg: Sun)
const wchar_t* as_short_wstring() const
{
static const wchar_t* const w_short_weekday_names[]={L"Sun", L"Mon", L"Tue",
L"Wed", L"Thu", L"Fri", L"Sat"};
return w_short_weekday_names[value_];
}
//! Return a point to a long english wchar_t string representing day of week
const wchar_t* as_long_wstring() const
{
static const wchar_t* const w_long_weekday_names[]= {L"Sunday",L"Monday",L"Tuesday",
L"Wednesday", L"Thursday",
L"Friday", L"Saturday"};
return w_long_weekday_names[value_];
}
const wchar_t* as_short_wstring() const;
const wchar_t* as_long_wstring() const;
#endif // BOOST_NO_STD_WSTRING
weekday_enum as_enum() const {return static_cast<weekday_enum>(value_);}
};
+12 -11
View File
@@ -1,7 +1,7 @@
#ifndef GREG_YEAR_HPP___
#define GREG_YEAR_HPP___
/* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003 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)
@@ -9,8 +9,7 @@
* $Date$
*/
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/constrained_value.hpp>
#include "boost/date_time/constrained_value.hpp"
#include <stdexcept>
#include <string>
@@ -18,29 +17,31 @@ namespace boost {
namespace gregorian {
//! Exception type for gregorian year
struct BOOST_SYMBOL_VISIBLE bad_year : public std::out_of_range
struct bad_year : public std::out_of_range
{
bad_year() :
std::out_of_range(std::string("Year is out of valid range: 1400..9999"))
std::out_of_range(std::string("Year is out of valid range: 1400..10000"))
{}
};
//! Policy class that declares error handling gregorian year type
typedef CV::simple_exception_policy<unsigned short, 1400, 9999, bad_year> greg_year_policies;
typedef CV::simple_exception_policy<unsigned short, 1400, 10000, bad_year> greg_year_policies;
//! Generated representation for gregorian year
typedef CV::constrained_value<greg_year_policies> greg_year_rep;
//! Represent a year (range 1400 - 9999)
//! Represent a day of the month (range 1900 - 10000)
/*! This small class allows for simple conversion an integer value into
a year for the gregorian calendar. This currently only allows a
range of 1400 to 9999. Both ends of the range are a bit arbitrary
range of 1900 to 10000. Both ends of the range are a bit arbitrary
at the moment, but they are the limits of current testing of the
library. As such they may be increased in the future.
*/
class BOOST_SYMBOL_VISIBLE greg_year : public greg_year_rep {
class greg_year : public greg_year_rep {
public:
BOOST_CXX14_CONSTEXPR greg_year(value_type year) : greg_year_rep(year) {}
BOOST_CXX14_CONSTEXPR operator value_type() const {return value_;}
greg_year(unsigned short year) : greg_year_rep(year) {}
operator unsigned short() const {return value_;}
private:
};
@@ -77,14 +77,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, d);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, d);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, d);
@@ -138,14 +138,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, dd);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, dd);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, dd);
@@ -202,14 +202,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, dp);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, dp);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, dp);
@@ -261,14 +261,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, m);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, m);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, m);
@@ -318,14 +318,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, wd);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, wd);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, wd);
@@ -359,14 +359,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, gd);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, gd);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, gd);
@@ -400,14 +400,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, gy);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, gy);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, gy);
@@ -458,14 +458,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, pd);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, pd);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, pd);
@@ -515,14 +515,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, nday);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, nday);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, nday);
@@ -573,14 +573,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, fkd);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, fkd);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, fkd);
@@ -631,14 +631,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, lkd);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, lkd);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, lkd);
@@ -690,14 +690,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, fka);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, fka);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, fka);
@@ -749,14 +749,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, fkb);
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, fkb);
}
else {
date_input_facet_local* f = new date_input_facet_local();
date_input_facet* f = new date_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, fkb);
+15 -34
View File
@@ -9,67 +9,48 @@
* $Date$
*/
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/date_parsing.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/parse_format_base.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/find_match.hpp>
#include "boost/date_time/gregorian/gregorian_types.hpp"
#include "boost/date_time/date_parsing.hpp"
#include "boost/date_time/compiler_config.hpp"
#include "boost/date_time/parse_format_base.hpp"
#include <string>
#include <iterator>
#include <sstream>
namespace boost {
namespace gregorian {
//! Return special_value from string argument
/*! Return special_value from string argument. If argument is
* not one of the special value names (defined in names.hpp),
/*! Return special_value from string argument. If argument is
* not one of the special value names (defined in src/gregorian/names.hpp),
* return 'not_special' */
inline
date_time::special_values
special_value_from_string(const std::string& s) {
static const char* const special_value_names[date_time::NumSpecialValues]
= {"not-a-date-time","-infinity","+infinity","min_date_time",
"max_date_time","not_special"};
short i = date_time::find_match(special_value_names,
special_value_names,
date_time::NumSpecialValues,
s);
if(i >= date_time::NumSpecialValues) { // match not found
return date_time::not_special;
}
else {
return static_cast<date_time::special_values>(i);
}
}
BOOST_DATE_TIME_DECL special_values special_value_from_string(const std::string& s);
//! Deprecated: Use from_simple_string
inline date from_string(const std::string& s) {
inline date from_string(std::string s) {
return date_time::parse_date<date>(s);
}
//! From delimited date string where with order year-month-day eg: 2002-1-25 or 2003-Jan-25 (full month name is also accepted)
inline date from_simple_string(const std::string& s) {
inline date from_simple_string(std::string s) {
return date_time::parse_date<date>(s, date_time::ymd_order_iso);
}
//! From delimited date string where with order year-month-day eg: 1-25-2003 or Jan-25-2003 (full month name is also accepted)
inline date from_us_string(const std::string& s) {
inline date from_us_string(std::string s) {
return date_time::parse_date<date>(s, date_time::ymd_order_us);
}
//! From delimited date string where with order day-month-year eg: 25-1-2002 or 25-Jan-2003 (full month name is also accepted)
inline date from_uk_string(const std::string& s) {
inline date from_uk_string(std::string s) {
return date_time::parse_date<date>(s, date_time::ymd_order_dmy);
}
//! From ISO 8601 type date string where with order year-month-day eg: 20020125
inline date from_undelimited_string(const std::string& s) {
//! From iso type date string where with order year-month-day eg: 20020125
inline date from_undelimited_string(std::string s) {
return date_time::parse_undelimited_date<date>(s);
}
//! From ISO 8601 type date string where with order year-month-day eg: 20020125
//! From iso type date string where with order year-month-day eg: 20020125
inline date date_from_iso_string(const std::string& s) {
return date_time::parse_undelimited_date<date>(s);
}
+18 -17
View File
@@ -9,7 +9,6 @@
* $Date$
*/
#include <boost/date_time/compiler_config.hpp>
namespace boost {
namespace date_time {
@@ -20,13 +19,13 @@ namespace date_time {
can be used in the creation of date systems or just to perform calculations.
All the methods of this class are static functions, so the intent is to
never create instances of this class.
@tparam ymd_type_ Struct type representing the year, month, day. The ymd_type must
@param ymd_type_ Struct type representing the year, month, day. The ymd_type must
define a of types for the year, month, and day. These types need to be
arithmetic types.
@tparam date_int_type_ Underlying type for the date count. Must be an arithmetic type.
@param date_int_type_ Underlying type for the date count. Must be an arithmetic type.
*/
template<typename ymd_type_, typename date_int_type_>
class BOOST_SYMBOL_VISIBLE gregorian_calendar_base {
class gregorian_calendar_base {
public:
//! define a type a date split into components
typedef ymd_type_ ymd_type;
@@ -40,18 +39,19 @@ namespace date_time {
typedef date_int_type_ date_int_type;
static BOOST_CXX14_CONSTEXPR unsigned short day_of_week(const ymd_type& ymd);
static BOOST_CXX14_CONSTEXPR int week_number(const ymd_type&ymd);
static BOOST_CXX14_CONSTEXPR date_int_type day_number(const ymd_type& ymd);
static BOOST_CXX14_CONSTEXPR date_int_type julian_day_number(const ymd_type& ymd);
static BOOST_CXX14_CONSTEXPR date_int_type modjulian_day_number(const ymd_type& ymd);
static BOOST_CXX14_CONSTEXPR ymd_type from_day_number(date_int_type);
static BOOST_CXX14_CONSTEXPR ymd_type from_julian_day_number(date_int_type);
static BOOST_CXX14_CONSTEXPR ymd_type from_modjulian_day_number(date_int_type);
static BOOST_CXX14_CONSTEXPR bool is_leap_year(year_type);
static BOOST_CXX14_CONSTEXPR unsigned short end_of_month_day(year_type y, month_type m);
static BOOST_CXX14_CONSTEXPR ymd_type epoch();
static BOOST_CXX14_CONSTEXPR unsigned short days_in_week();
static unsigned short day_of_week(const ymd_type& ymd);
static int week_number(const ymd_type&ymd);
//static unsigned short day_of_year(date_int_type);
static date_int_type day_number(const ymd_type& ymd);
static date_int_type julian_day_number(const ymd_type& ymd);
static date_int_type modjulian_day_number(const ymd_type& ymd);
static ymd_type from_day_number(date_int_type);
static ymd_type from_julian_day_number(date_int_type);
static ymd_type from_modjulian_day_number(date_int_type);
static bool is_leap_year(year_type);
static unsigned short end_of_month_day(year_type y, month_type m);
static ymd_type epoch();
static unsigned short days_in_week();
};
@@ -59,8 +59,9 @@ namespace date_time {
} } //namespace
#ifndef NO_BOOST_DATE_TIME_INLINE
#include "boost/date_time/gregorian_calendar.ipp"
#endif
+31 -36
View File
@@ -6,6 +6,10 @@
* $Date$
*/
#ifndef NO_BOOST_DATE_TIME_INLINE
#undef BOOST_DATE_TIME_INLINE
#define BOOST_DATE_TIME_INLINE inline
#endif
namespace boost {
namespace date_time {
@@ -13,8 +17,7 @@ namespace date_time {
/*! Converts a year-month-day into a day of the week number
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
unsigned short
gregorian_calendar_base<ymd_type_,date_int_type_>::day_of_week(const ymd_type& ymd) {
unsigned short a = static_cast<unsigned short>((14-ymd.month)/12);
@@ -25,15 +28,14 @@ namespace date_time {
return d;
}
//!Return the ISO 8601 week number for the date
/*!Implements the rules associated with the ISO 8601 week number.
//!Return the iso week number for the date
/*!Implements the rules associated with the iso 8601 week number.
Basically the rule is that Week 1 of the year is the week that contains
January 4th or the week that contains the first Thursday in January.
Reference for this algorithm is the Calendar FAQ by Claus Tondering, April 2000.
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
int
gregorian_calendar_base<ymd_type_,date_int_type_>::week_number(const ymd_type& ymd) {
unsigned long julianbegin = julian_day_number(ymd_type(ymd.year,1,1));
@@ -42,12 +44,12 @@ namespace date_time {
unsigned long week = (juliantoday + day - julianbegin + 4)/7;
if ((week >= 1) && (week <= 52)) {
return static_cast<int>(week);
return week;
}
if (week == 53) {
if ((week == 53)) {
if((day==6) ||(day == 5 && is_leap_year(ymd.year))) {
return static_cast<int>(week); //under these circumstances week == 53.
return week; //under these circumstances week == 53.
} else {
return 1; //monday - wednesday is in week 1 of next year
}
@@ -58,10 +60,10 @@ namespace date_time {
juliantoday = julian_day_number(ymd);
day = (julianbegin + 3) % 7;
week = (juliantoday + day - julianbegin + 4)/7;
return static_cast<int>(week);
return week;
}
return static_cast<int>(week); //not reachable -- well except if day == 5 and is_leap_year != true
return week; //not reachable -- well except if day == 5 and is_leap_year != true
}
@@ -69,24 +71,22 @@ namespace date_time {
/*! The day number is an absolute number of days since the start of count
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
date_int_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::day_number(const ymd_type& ymd)
{
unsigned short a = static_cast<unsigned short>((14-ymd.month)/12);
unsigned short y = static_cast<unsigned short>(ymd.year + 4800 - a);
unsigned short m = static_cast<unsigned short>(ymd.month + 12*a - 3);
unsigned long d = static_cast<unsigned long>(ymd.day) + ((153*m + 2)/5) + 365*y + (y/4) - (y/100) + (y/400) - 32045;
return static_cast<date_int_type>(d);
unsigned long d = ymd.day + ((153*m + 2)/5) + 365*y + (y/4) - (y/100) + (y/400) - 32045;
return d;
}
//! Convert a year-month-day into the julian day number
/*! Since this implementation uses julian day internally, this is the same as the day_number.
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
date_int_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::julian_day_number(const ymd_type& ymd)
{
@@ -98,8 +98,7 @@ namespace date_time {
* MJD 0 thus started on 17 Nov 1858(Gregorian) at 00:00:00 UTC
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
date_int_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::modjulian_day_number(const ymd_type& ymd)
{
@@ -108,8 +107,7 @@ namespace date_time {
//! Change a day number into a year-month-day
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
ymd_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::from_day_number(date_int_type dayNumber)
{
@@ -129,8 +127,7 @@ namespace date_time {
//! Change a day number into a year-month-day
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
ymd_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::from_julian_day_number(date_int_type dayNumber)
{
@@ -150,8 +147,7 @@ namespace date_time {
//! Change a modified julian day number into a year-month-day
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
ymd_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::from_modjulian_day_number(date_int_type dayNumber) {
date_int_type jd = dayNumber + 2400001; //is 2400000.5 prerounded
@@ -163,8 +159,7 @@ namespace date_time {
*@return true if year is a leap year, false otherwise
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
bool
gregorian_calendar_base<ymd_type_,date_int_type_>::is_leap_year(year_type year)
{
@@ -177,8 +172,7 @@ namespace date_time {
* No error checking is performed.
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
unsigned short
gregorian_calendar_base<ymd_type_,date_int_type_>::end_of_month_day(year_type year,
month_type month)
@@ -189,7 +183,7 @@ namespace date_time {
return 29;
} else {
return 28;
}
};
case 4:
case 6:
case 9:
@@ -197,13 +191,13 @@ namespace date_time {
return 30;
default:
return 31;
}
};
}
//! Provide the ymd_type specification for the calendar start
//! Provide the ymd_type specification for the calandar start
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
ymd_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::epoch()
{
@@ -212,8 +206,7 @@ namespace date_time {
//! Defines length of a week for week calculations
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
BOOST_DATE_TIME_INLINE
unsigned short
gregorian_calendar_base<ymd_type_,date_int_type_>::days_in_week()
{
@@ -222,3 +215,5 @@ namespace date_time {
} } //namespace gregorian
+78 -85
View File
@@ -18,12 +18,6 @@
# include <ostream>
#endif
#if defined(BOOST_MSVC)
#pragma warning(push)
// conditional expression is constant
#pragma warning(disable: 4127)
#endif
namespace boost {
namespace date_time {
@@ -46,34 +40,34 @@ template<typename int_type_>
class int_adapter {
public:
typedef int_type_ int_type;
BOOST_CXX14_CONSTEXPR int_adapter(int_type v) :
int_adapter(int_type v) :
value_(v)
{}
static BOOST_CONSTEXPR bool has_infinity()
static bool has_infinity()
{
return true;
}
static BOOST_CONSTEXPR int_adapter pos_infinity()
static const int_adapter pos_infinity()
{
return (::std::numeric_limits<int_type>::max)();
}
static BOOST_CONSTEXPR int_adapter neg_infinity()
static const int_adapter neg_infinity()
{
return (::std::numeric_limits<int_type>::min)();
}
static BOOST_CONSTEXPR int_adapter not_a_number()
static const int_adapter not_a_number()
{
return (::std::numeric_limits<int_type>::max)()-1;
}
static BOOST_CONSTEXPR int_adapter max BOOST_PREVENT_MACRO_SUBSTITUTION ()
static int_adapter max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return (::std::numeric_limits<int_type>::max)()-2;
}
static BOOST_CONSTEXPR int_adapter min BOOST_PREVENT_MACRO_SUBSTITUTION ()
static int_adapter min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return (::std::numeric_limits<int_type>::min)()+1;
}
static BOOST_CXX14_CONSTEXPR int_adapter from_special(special_values sv)
static int_adapter from_special(special_values sv)
{
switch (sv) {
case not_a_date_time: return not_a_number();
@@ -84,25 +78,25 @@ public:
default: return not_a_number();
}
}
static BOOST_CONSTEXPR bool is_inf(int_type v)
static bool is_inf(int_type v)
{
return (v == neg_infinity().as_number() ||
v == pos_infinity().as_number());
}
static BOOST_CXX14_CONSTEXPR bool is_neg_inf(int_type v)
static bool is_neg_inf(int_type v)
{
return (v == neg_infinity().as_number());
}
static BOOST_CXX14_CONSTEXPR bool is_pos_inf(int_type v)
static bool is_pos_inf(int_type v)
{
return (v == pos_infinity().as_number());
}
static BOOST_CXX14_CONSTEXPR bool is_not_a_number(int_type v)
static bool is_not_a_number(int_type v)
{
return (v == not_a_number().as_number());
}
//! Returns either special value type or is_not_special
static BOOST_CXX14_CONSTEXPR special_values to_special(int_type v)
static special_values to_special(int_type v)
{
if (is_not_a_number(v)) return not_a_date_time;
if (is_neg_inf(v)) return neg_infin;
@@ -111,38 +105,40 @@ public:
}
//-3 leaves room for representations of infinity and not a date
static BOOST_CONSTEXPR int_type maxcount()
static int_type maxcount()
{
return (::std::numeric_limits<int_type>::max)()-3;
}
BOOST_CONSTEXPR bool is_infinity() const
bool is_infinity() const
{
return (value_ == neg_infinity().as_number() ||
value_ == pos_infinity().as_number());
}
BOOST_CONSTEXPR bool is_pos_infinity()const
bool is_pos_infinity()const
{
return(value_ == pos_infinity().as_number());
}
BOOST_CONSTEXPR bool is_neg_infinity()const
bool is_neg_infinity()const
{
return(value_ == neg_infinity().as_number());
}
BOOST_CONSTEXPR bool is_nan() const
bool is_nan() const
{
return (value_ == not_a_number().as_number());
}
BOOST_CONSTEXPR bool is_special() const
bool is_special() const
{
return(is_infinity() || is_nan());
}
BOOST_CONSTEXPR bool operator==(const int_adapter& rhs) const
bool operator==(const int_adapter& rhs) const
{
return (compare(rhs) == 0);
}
BOOST_CXX14_CONSTEXPR bool operator==(const int& rhs) const
bool operator==(const int& rhs) const
{
if(!std::numeric_limits<int_type>::is_signed)
// quiets compiler warnings
bool is_signed = std::numeric_limits<int_type>::is_signed;
if(!is_signed)
{
if(is_neg_inf(value_) && rhs == 0)
{
@@ -151,29 +147,32 @@ public:
}
return (compare(rhs) == 0);
}
BOOST_CONSTEXPR bool operator!=(const int_adapter& rhs) const
bool operator!=(const int_adapter& rhs) const
{
return (compare(rhs) != 0);
}
BOOST_CXX14_CONSTEXPR bool operator!=(const int& rhs) const
{
if(!std::numeric_limits<int_type>::is_signed)
{
if(is_neg_inf(value_) && rhs == 0)
{
return true;
}
}
return (compare(rhs) != 0);
}
BOOST_CONSTEXPR bool operator<(const int_adapter& rhs) const
{
return (compare(rhs) == -1);
}
BOOST_CXX14_CONSTEXPR bool operator<(const int& rhs) const
bool operator!=(const int& rhs) const
{
// quiets compiler warnings
if(!std::numeric_limits<int_type>::is_signed)
bool is_signed = std::numeric_limits<int_type>::is_signed;
if(!is_signed)
{
if(is_neg_inf(value_) && rhs == 0)
{
return true;
}
}
return (compare(rhs) != 0);
}
bool operator<(const int_adapter& rhs) const
{
return (compare(rhs) == -1);
}
bool operator<(const int& rhs) const
{
// quiets compiler warnings
bool is_signed = std::numeric_limits<int_type>::is_signed;
if(!is_signed)
{
if(is_neg_inf(value_) && rhs == 0)
{
@@ -182,16 +181,16 @@ public:
}
return (compare(rhs) == -1);
}
BOOST_CONSTEXPR bool operator>(const int_adapter& rhs) const
bool operator>(const int_adapter& rhs) const
{
return (compare(rhs) == 1);
}
BOOST_CONSTEXPR int_type as_number() const
int_type as_number() const
{
return value_;
}
//! Returns either special value type or is_not_special
BOOST_CONSTEXPR special_values as_special() const
special_values as_special() const
{
return int_adapter::to_special(value_);
}
@@ -204,7 +203,7 @@ public:
/*! Operator allows for adding dissimilar int_adapter types.
* The return type will match that of the the calling object's type */
template<class rhs_type>
BOOST_CXX14_CONSTEXPR
inline
int_adapter operator+(const int_adapter<rhs_type>& rhs) const
{
if(is_special() || rhs.is_special())
@@ -231,10 +230,9 @@ public:
return int_adapter::neg_infinity();
}
}
return int_adapter<int_type>(value_ + static_cast<int_type>(rhs.as_number()));
return int_adapter<int_type>(value_ + rhs.as_number());
}
BOOST_CXX14_CONSTEXPR
int_adapter operator+(const int_type rhs) const
{
if(is_special())
@@ -254,7 +252,7 @@ public:
/*! Operator allows for subtracting dissimilar int_adapter types.
* The return type will match that of the the calling object's type */
template<class rhs_type>
BOOST_CXX14_CONSTEXPR
inline
int_adapter operator-(const int_adapter<rhs_type>& rhs)const
{
if(is_special() || rhs.is_special())
@@ -281,10 +279,8 @@ public:
return int_adapter::pos_infinity();
}
}
return int_adapter<int_type>(value_ - static_cast<int_type>(rhs.as_number()));
return int_adapter<int_type>(value_ - rhs.as_number());
}
BOOST_CXX14_CONSTEXPR
int_adapter operator-(const int_type rhs) const
{
if(is_special())
@@ -302,7 +298,6 @@ public:
}
// should templatize this to be consistant with op +-
BOOST_CXX14_CONSTEXPR
int_adapter operator*(const int_adapter& rhs)const
{
if(this->is_special() || rhs.is_special())
@@ -311,10 +306,8 @@ public:
}
return int_adapter<int_type>(value_ * rhs.value_);
}
/*! Provided for cases when automatic conversion from
* 'int' to 'int_adapter' causes incorrect results. */
BOOST_CXX14_CONSTEXPR
int_adapter operator*(const int rhs) const
{
if(is_special())
@@ -325,7 +318,6 @@ public:
}
// should templatize this to be consistant with op +-
BOOST_CXX14_CONSTEXPR
int_adapter operator/(const int_adapter& rhs)const
{
if(this->is_special() || rhs.is_special())
@@ -339,27 +331,23 @@ public:
return mult_div_specials(rhs);
}
else { // let divide by zero blow itself up
return int_adapter<int_type>(value_ / rhs.value_); //NOLINT
return int_adapter<int_type>(value_ / rhs.value_);
}
}
return int_adapter<int_type>(value_ / rhs.value_);
}
/*! Provided for cases when automatic conversion from
* 'int' to 'int_adapter' causes incorrect results. */
BOOST_CXX14_CONSTEXPR
int_adapter operator/(const int rhs) const
{
if(is_special() && rhs != 0)
{
return mult_div_specials(rhs);
}
// let divide by zero blow itself up like int
return int_adapter<int_type>(value_ / rhs); //NOLINT
return int_adapter<int_type>(value_ / rhs);
}
// should templatize this to be consistant with op +-
BOOST_CXX14_CONSTEXPR
int_adapter operator%(const int_adapter& rhs)const
{
if(this->is_special() || rhs.is_special())
@@ -373,31 +361,26 @@ public:
return mult_div_specials(rhs);
}
else { // let divide by zero blow itself up
return int_adapter<int_type>(value_ % rhs.value_); //NOLINT
return int_adapter<int_type>(value_ % rhs.value_);
}
}
return int_adapter<int_type>(value_ % rhs.value_);
}
/*! Provided for cases when automatic conversion from
* 'int' to 'int_adapter' causes incorrect results. */
BOOST_CXX14_CONSTEXPR
int_adapter operator%(const int rhs) const
{
if(is_special() && rhs != 0)
{
return mult_div_specials(rhs);
}
// let divide by zero blow itself up
return int_adapter<int_type>(value_ % rhs); //NOLINT
return int_adapter<int_type>(value_ % rhs);
}
private:
int_type value_;
//! returns -1, 0, 1, or 2 if 'this' is <, ==, >, or 'nan comparison' rhs
BOOST_CXX14_CONSTEXPR
int compare( const int_adapter& rhs ) const
int compare(const int_adapter& rhs)const
{
if(this->is_special() || rhs.is_special())
{
@@ -424,19 +407,25 @@ private:
// implied-> if(value_ == rhs.value_)
return 0;
}
/* When multiplying and dividing with at least 1 special value
* very simmilar rules apply. In those cases where the rules
* are different, they are handled in the respective operator
* function. */
//! Assumes at least 'this' or 'rhs' is a special value
BOOST_CXX14_CONSTEXPR
int_adapter mult_div_specials(const int_adapter& rhs) const
int_adapter mult_div_specials(const int_adapter& rhs)const
{
int min_value;
// quiets compiler warnings
bool is_signed = std::numeric_limits<int_type>::is_signed;
if(is_signed) {
min_value = 0;
}
else {
min_value = 1;// there is no zero with unsigned
}
if(this->is_nan() || rhs.is_nan()) {
return int_adapter<int_type>(not_a_number());
}
BOOST_CONSTEXPR_OR_CONST int min_value = std::numeric_limits<int_type>::is_signed ? 0 : 1;
if((*this > 0 && rhs > 0) || (*this < min_value && rhs < min_value)) {
return int_adapter<int_type>(pos_infinity());
}
@@ -446,20 +435,26 @@ private:
//implied -> if(this->value_ == 0 || rhs.value_ == 0)
return int_adapter<int_type>(not_a_number());
}
/* Overloaded function necessary because of special
* situation where int_adapter is instantiated with
* 'unsigned' and func is called with negative int.
* It would produce incorrect results since 'unsigned'
* wraps around when initialized with a negative value */
//! Assumes 'this' is a special value
BOOST_CXX14_CONSTEXPR
int_adapter mult_div_specials(const int& rhs) const
{
int min_value;
// quiets compiler warnings
bool is_signed = std::numeric_limits<int_type>::is_signed;
if(is_signed) {
min_value = 0;
}
else {
min_value = 1;// there is no zero with unsigned
}
if(this->is_nan()) {
return int_adapter<int_type>(not_a_number());
}
BOOST_CONSTEXPR_OR_CONST int min_value = std::numeric_limits<int_type>::is_signed ? 0 : 1;
if((*this > 0 && rhs > 0) || (*this < min_value && rhs < 0)) {
return int_adapter<int_type>(pos_infinity());
}
@@ -469,7 +464,7 @@ private:
//implied -> if(this->value_ == 0 || rhs.value_ == 0)
return int_adapter<int_type>(not_a_number());
}
};
#ifndef BOOST_DATE_TIME_NO_LOCALE
@@ -509,8 +504,6 @@ private:
} } //namespace date_time
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#endif
+13 -13
View File
@@ -14,11 +14,11 @@
namespace boost {
namespace date_time {
//! Class to provide common ISO 8601 formatting spec
//! Class to provide common iso formatting spec
template<class charT>
class iso_format_base {
public:
//! Describe month format -- its an integer in ISO 8601 format
//! Describe month format -- its an integer in iso format
static month_format_spec month_format()
{
return month_as_integer;
@@ -40,17 +40,17 @@ public:
return "-infinity";
}
//! ISO 8601 char for a year -- used in durations
//! ISO char for a year -- used in durations
static charT year_sep_char()
{
return 'Y';
}
//! ISO 8601 char for a month
//! ISO char for a month
static charT month_sep_char()
{
return '-';
}
//! ISO 8601 char for a day
//! ISO char for a day
static charT day_sep_char()
{
return '-';
@@ -70,7 +70,7 @@ public:
{
return ':';
}
//! ISO 8601 char for a period
//! ISO char for a period
static charT period_start_char()
{
return 'P';
@@ -143,11 +143,11 @@ public:
#ifndef BOOST_NO_STD_WSTRING
//! Class to provide common ISO 8601 formatting spec
//! Class to provide common iso formatting spec
template<>
class iso_format_base<wchar_t> {
public:
//! Describe month format -- its an integer in ISO 8601 format
//! Describe month format -- its an integer in iso format
static month_format_spec month_format()
{
return month_as_integer;
@@ -169,17 +169,17 @@ public:
return L"-infinity";
}
//! ISO 8601 char for a year -- used in durations
//! ISO char for a year -- used in durations
static wchar_t year_sep_char()
{
return 'Y';
}
//! ISO 8601 char for a month
//! ISO char for a month
static wchar_t month_sep_char()
{
return '-';
}
//! ISO 8601 char for a day
//! ISO char for a day
static wchar_t day_sep_char()
{
return '-';
@@ -199,7 +199,7 @@ public:
{
return ':';
}
//! ISO 8601 char for a period
//! ISO char for a period
static wchar_t period_start_char()
{
return 'P';
@@ -272,7 +272,7 @@ public:
#endif // BOOST_NO_STD_WSTRING
//! Format description for ISO 8601 normal YYYYMMDD
//! Format description for iso normal YYYYMMDD
template<class charT>
class iso_format : public iso_format_base<charT> {
public:
@@ -2,7 +2,7 @@
#define LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__
/* Copyright (c) 2003-2005 CrystalClear Software, Inc.
* Subject to the Boost Software License, Version 1.0.
* 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$
@@ -34,8 +34,8 @@ namespace local_time {
typedef typename base_type::stringstream_type stringstream_type;
typedef date_time::time_zone_names_base<CharT> time_zone_names;
typedef CharT char_type;
custom_time_zone_base(const time_zone_names& zone_names,
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<dst_calc_rule> calc_rule) :
@@ -43,8 +43,8 @@ namespace local_time {
base_utc_offset_(utc_offset),
dst_offsets_(dst_shift),
dst_calc_rules_(calc_rule)
{}
virtual ~custom_time_zone_base() {}
{};
virtual ~custom_time_zone_base() {};
virtual string_type dst_zone_abbrev() const
{
return zone_names_.dst_zone_abbrev();
@@ -64,7 +64,7 @@ namespace local_time {
//! True if zone uses daylight savings adjustments
virtual bool has_dst() const
{
return (bool) dst_calc_rules_; //if calc_rule is set the tz has dst
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
@@ -154,6 +154,7 @@ namespace local_time {
}
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_rule> dst_calc_rules_;
@@ -16,7 +16,6 @@
#include <boost/throw_exception.hpp>
#include <boost/date_time/time.hpp>
#include <boost/date_time/posix_time/posix_time.hpp> //todo remove?
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/dst_rules.hpp>
#include <boost/date_time/time_zone_base.hpp>
#include <boost/date_time/special_defs.hpp>
@@ -26,18 +25,18 @@ namespace boost {
namespace local_time {
//! simple exception for reporting when STD or DST cannot be determined
struct BOOST_SYMBOL_VISIBLE ambiguous_result : public std::logic_error
struct ambiguous_result : public std::logic_error
{
ambiguous_result (std::string const& msg = std::string()) :
std::logic_error(std::string("Daylight Savings Results are ambiguous: " + msg)) {}
};
//! simple exception for when time label given cannot exist
struct BOOST_SYMBOL_VISIBLE time_label_invalid : public std::logic_error
struct time_label_invalid : public std::logic_error
{
time_label_invalid (std::string const& msg = std::string()) :
std::logic_error(std::string("Time label given is invalid: " + msg)) {}
};
struct BOOST_SYMBOL_VISIBLE dst_not_valid: public std::logic_error
struct dst_not_valid: public std::logic_error
{
dst_not_valid(std::string const& msg = std::string()) :
std::logic_error(std::string("is_dst flag does not match resulting dst for time label given: " + msg)) {}
@@ -62,7 +61,7 @@ namespace local_time {
*/
template<class utc_time_=posix_time::ptime,
class tz_type=date_time::time_zone_base<utc_time_,char> >
class BOOST_SYMBOL_VISIBLE local_date_time_base : public date_time::base_time<utc_time_,
class local_date_time_base : public date_time::base_time<utc_time_,
boost::posix_time::posix_time_system> {
public:
typedef utc_time_ utc_time_type;
@@ -209,7 +208,7 @@ namespace local_time {
}
//! Simple destructor, releases time zone if last referrer
~local_date_time_base() {}
~local_date_time_base() {};
//! Copy constructor
local_date_time_base(const local_date_time_base& rhs) :
@@ -315,7 +314,7 @@ namespace local_time {
//! Returns name of associated time zone or "Coordinated Universal Time".
/*! Optional bool parameter will return time zone as an offset
* (ie "+07:00" extended ISO 8601 format). Empty string is returned for
* (ie "+07:00" extended iso format). Empty string is returned for
* classes that do not use a time_zone */
std::string zone_name(bool as_offset=false) const
{
@@ -349,7 +348,7 @@ namespace local_time {
}
//! Returns abbreviation of associated time zone or "UTC".
/*! Optional bool parameter will return time zone as an offset
* (ie "+0700" ISO 8601 format). Empty string is returned for classes
* (ie "+0700" iso format). Empty string is returned for classes
* that do not use a time_zone */
std::string zone_abbrev(bool as_offset=false) const
{
@@ -8,15 +8,12 @@
* $Date$
*/
#include <string>
#include <locale>
#include <iostream>
#include <iterator> // i/ostreambuf_iterator
#include <boost/io/ios_state.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/time_facet.hpp>
#include <boost/date_time/string_convert.hpp>
#include <boost/date_time/local_time/local_time_types.hpp>
#include <boost/date_time/local_time/local_date_time.hpp>
#include <boost/date_time/local_time/posix_time_zone.hpp>
#include <boost/date_time/local_time/conversion.hpp> // to_tm will be needed in the facets
@@ -39,6 +36,7 @@ namespace local_time {
boost::io::ios_flags_saver iflags(os);
typedef local_date_time time_type;//::utc_time_type typename
typedef date_time::time_facet<time_type, CharT> custom_time_facet;
typedef std::time_put<CharT> std_time_facet;
std::ostreambuf_iterator<CharT> oitr(os);
if(std::has_facet<custom_time_facet>(os.getloc())) {
@@ -125,6 +123,7 @@ namespace local_time {
const boost::local_time::local_time_period& p) {
boost::io::ios_flags_saver iflags(os);
typedef boost::date_time::time_facet<local_date_time, CharT> custom_facet;
typedef std::time_put<CharT> std_time_facet;
std::ostreambuf_iterator<CharT> oitr(os);
if (std::has_facet<custom_facet>(os.getloc())) {
std::use_facet<custom_facet>(os.getloc()).put(oitr, os, os.fill(), p);
@@ -13,7 +13,6 @@
#include <stdexcept>
#include <boost/tokenizer.hpp>
#include <boost/throw_exception.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/time_zone_names.hpp>
#include <boost/date_time/time_zone_base.hpp>
@@ -26,13 +25,13 @@ namespace boost{
namespace local_time{
//! simple exception for UTC and Daylight savings start/end offsets
struct BOOST_SYMBOL_VISIBLE bad_offset : public std::out_of_range
struct bad_offset : public std::out_of_range
{
bad_offset(std::string const& msg = std::string()) :
std::out_of_range(std::string("Offset out of range: " + msg)) {}
};
//! simple exception for UTC daylight savings adjustment
struct BOOST_SYMBOL_VISIBLE bad_adjustment : public std::out_of_range
struct bad_adjustment : public std::out_of_range
{
bad_adjustment(std::string const& msg = std::string()) :
std::out_of_range(std::string("Adjustment out of range: " + msg)) {}
@@ -68,7 +67,7 @@ namespace local_time{
* http://www.worldtimezone.com/utc/utc+1200.html
*/
template<class CharT>
class BOOST_SYMBOL_VISIBLE posix_time_zone_base : public date_time::time_zone_base<posix_time::ptime,CharT> {
class posix_time_zone_base : public date_time::time_zone_base<posix_time::ptime,CharT> {
public:
typedef boost::posix_time::time_duration time_duration_type;
typedef date_time::time_zone_names_base<CharT> time_zone_names;
@@ -116,7 +115,7 @@ namespace local_time{
calc_rules(dst_begin, dst_end);
}
}
virtual ~posix_time_zone_base() {}
virtual ~posix_time_zone_base() {};
//!String for the zone when not in daylight savings (eg: EST)
virtual string_type std_zone_abbrev()const
{
@@ -431,9 +430,9 @@ namespace local_time{
dst_calc_rules_ = shared_ptr<dst_calc_rule>(
new partial_date_dst_rule(
partial_date_dst_rule::start_rule(
static_cast<unsigned short>(sd), static_cast<date_time::months_of_year>(sm)),
sd, static_cast<date_time::months_of_year>(sm)),
partial_date_dst_rule::end_rule(
static_cast<unsigned short>(ed), static_cast<date_time::months_of_year>(em))
ed, static_cast<date_time::months_of_year>(em))
)
);
}
+3 -5
View File
@@ -1,7 +1,7 @@
#ifndef DATE_TIME_LOCALE_CONFIG_HPP___
#define DATE_TIME_LOCALE_CONFIG_HPP___
/* Copyright (c) 2002-2020 CrystalClear Software, Inc.
/* Copyright (c) 2002-2006 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)
@@ -17,14 +17,12 @@
// defines BOOST_NO_STD_LOCALE (gcc 2.95.x)
#include "boost/config.hpp" //sets BOOST_NO_STD_LOCALE
#include "boost/config/workaround.hpp"
#include "boost/detail/workaround.hpp"
//This file basically becomes a noop if locales are not properly supported
#if (defined(BOOST_NO_STD_LOCALE) \
|| (BOOST_WORKAROUND( BOOST_MSVC, < 1300)) \
|| (BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT( 0x581 )) ) \
|| (BOOST_WORKAROUND( BOOST_XLCPP_ZOS, BOOST_TESTED_AT( 0x42010000 )) ) /* <cctype> "shadows" the locale enabled overloads from <locale> */ \
)
|| (BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x581 )) ) )
#define BOOST_DATE_TIME_NO_LOCALE
#endif
@@ -20,9 +20,7 @@
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/c_time.hpp>
#include <boost/date_time/time_clock.hpp>
#if defined(BOOST_HAS_FTIME)
#include <boost/winapi/time.hpp>
#endif
#include <boost/date_time/filetime_functions.hpp>
#ifdef BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
@@ -87,21 +85,12 @@ namespace date_time {
std::time_t t = tv.tv_sec;
boost::uint32_t sub_sec = tv.tv_usec;
#elif defined(BOOST_HAS_FTIME)
boost::winapi::FILETIME_ ft;
boost::winapi::GetSystemTimeAsFileTime(&ft);
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
// Some runtime library implementations expect local times as the norm for ctime functions.
{
boost::winapi::FILETIME_ local_ft;
boost::winapi::FileTimeToLocalFileTime(&ft, &local_ft);
ft = local_ft;
}
#endif
boost::uint64_t micros = file_time_to_microseconds(ft); // it will not wrap, since ft is the current time
// and cannot be before 1970-Jan-01
winapi::file_time ft;
winapi::get_system_time_as_file_time(ft);
uint64_t micros = winapi::file_time_to_microseconds(ft); // it will not wrap, since ft is the current time
// and cannot be before 1970-Jan-01
std::time_t t = static_cast<std::time_t>(micros / 1000000UL); // seconds since epoch
// microseconds -- static casts suppress warnings
// microseconds -- static casts supress warnings
boost::uint32_t sub_sec = static_cast<boost::uint32_t>(micros % 1000000UL);
#else
#error Internal Boost.DateTime error: BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK is defined, however neither gettimeofday nor FILETIME support is detected.
@@ -126,26 +115,6 @@ namespace date_time {
return time_type(d,td);
}
#if defined(BOOST_HAS_FTIME)
/*!
* The function converts file_time into number of microseconds elapsed since 1970-Jan-01
*
* \note Only dates after 1970-Jan-01 are supported. Dates before will be wrapped.
*/
static boost::uint64_t file_time_to_microseconds(boost::winapi::FILETIME_ const& ft)
{
// shift is difference between 1970-Jan-01 & 1601-Jan-01
// in 100-nanosecond units
const boost::uint64_t shift = 116444736000000000ULL; // (27111902 << 32) + 3577643008
// 100-nanos since 1601-Jan-01
boost::uint64_t ft_as_integer = (static_cast< boost::uint64_t >(ft.dwHighDateTime) << 32) | static_cast< boost::uint64_t >(ft.dwLowDateTime);
ft_as_integer -= shift; // filetime is now 100-nanos since 1970-Jan-01
return (ft_as_integer / 10U); // truncate to microseconds
}
#endif
};
+52 -48
View File
@@ -17,8 +17,7 @@
*/
#include <boost/operators.hpp>
#include <boost/date_time/compiler_config.hpp>
#include "boost/operators.hpp"
namespace boost {
@@ -49,7 +48,7 @@ namespace date_time {
*/
template<class point_rep, class duration_rep>
class BOOST_SYMBOL_VISIBLE period : private
class period : private
boost::less_than_comparable<period<point_rep, duration_rep>
, boost::equality_comparable< period<point_rep, duration_rep>
> >
@@ -58,26 +57,26 @@ namespace date_time {
typedef point_rep point_type;
typedef duration_rep duration_type;
BOOST_CXX14_CONSTEXPR period(point_rep first_point, point_rep end_point);
BOOST_CXX14_CONSTEXPR period(point_rep first_point, duration_rep len);
BOOST_CXX14_CONSTEXPR point_rep begin() const;
BOOST_CXX14_CONSTEXPR point_rep end() const;
BOOST_CXX14_CONSTEXPR point_rep last() const;
BOOST_CXX14_CONSTEXPR duration_rep length() const;
BOOST_CXX14_CONSTEXPR bool is_null() const;
BOOST_CXX14_CONSTEXPR bool operator==(const period& rhs) const;
BOOST_CXX14_CONSTEXPR bool operator<(const period& rhs) const;
BOOST_CXX14_CONSTEXPR void shift(const duration_rep& d);
BOOST_CXX14_CONSTEXPR void expand(const duration_rep& d);
BOOST_CXX14_CONSTEXPR bool contains(const point_rep& point) const;
BOOST_CXX14_CONSTEXPR bool contains(const period& other) const;
BOOST_CXX14_CONSTEXPR bool intersects(const period& other) const;
BOOST_CXX14_CONSTEXPR bool is_adjacent(const period& other) const;
BOOST_CXX14_CONSTEXPR bool is_before(const point_rep& point) const;
BOOST_CXX14_CONSTEXPR bool is_after(const point_rep& point) const;
BOOST_CXX14_CONSTEXPR period intersection(const period& other) const;
BOOST_CXX14_CONSTEXPR period merge(const period& other) const;
BOOST_CXX14_CONSTEXPR period span(const period& other) const;
period(point_rep first_point, point_rep end_point);
period(point_rep first_point, duration_rep len);
point_rep begin() const;
point_rep end() const;
point_rep last() const;
duration_rep length() const;
bool is_null() const;
bool operator==(const period& rhs) const;
bool operator<(const period& rhs) const;
void shift(const duration_rep& d);
void expand(const duration_rep& d);
bool contains(const point_rep& point) const;
bool contains(const period& other) const;
bool intersects(const period& other) const;
bool is_adjacent(const period& other) const;
bool is_before(const point_rep& point) const;
bool is_after(const point_rep& point) const;
period intersection(const period& other) const;
period merge(const period& other) const;
period span(const period& other) const;
private:
point_rep begin_;
point_rep last_;
@@ -87,7 +86,7 @@ namespace date_time {
/*! If end <= begin then the period will be invalid
*/
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
period<point_rep,duration_rep>::period(point_rep first_point,
point_rep end_point) :
begin_(first_point),
@@ -98,7 +97,7 @@ namespace date_time {
/*! If len is <= 0 then the period will be invalid
*/
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
period<point_rep,duration_rep>::period(point_rep first_point, duration_rep len) :
begin_(first_point),
last_(first_point + len-duration_rep::unit())
@@ -107,7 +106,7 @@ namespace date_time {
//! Return the first element in the period
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
point_rep period<point_rep,duration_rep>::begin() const
{
return begin_;
@@ -115,7 +114,7 @@ namespace date_time {
//! Return one past the last element
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
point_rep period<point_rep,duration_rep>::end() const
{
return last_ + duration_rep::unit();
@@ -123,7 +122,7 @@ namespace date_time {
//! Return the last item in the period
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
point_rep period<point_rep,duration_rep>::last() const
{
return last_;
@@ -131,7 +130,7 @@ namespace date_time {
//! True if period is ill formed (length is zero or less)
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
bool period<point_rep,duration_rep>::is_null() const
{
return end() <= begin_;
@@ -139,7 +138,7 @@ namespace date_time {
//! Return the length of the period
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
duration_rep period<point_rep,duration_rep>::length() const
{
if(last_ < begin_){ // invalid period
@@ -152,7 +151,7 @@ namespace date_time {
//! Equality operator
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
bool period<point_rep,duration_rep>::operator==(const period& rhs) const
{
return ((begin_ == rhs.begin_) &&
@@ -161,7 +160,7 @@ namespace date_time {
//! Strict as defined by rhs.last <= lhs.last
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
bool period<point_rep,duration_rep>::operator<(const period& rhs) const
{
return (last_ < rhs.begin_);
@@ -170,7 +169,7 @@ namespace date_time {
//! Shift the start and end by the specified amount
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
void period<point_rep,duration_rep>::shift(const duration_rep& d)
{
begin_ = begin_ + d;
@@ -197,7 +196,7 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
void period<point_rep,duration_rep>::expand(const duration_rep& d)
{
begin_ = begin_ - d;
@@ -206,7 +205,7 @@ namespace date_time {
//! True if the point is inside the period, zero length periods contain no points
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
bool period<point_rep,duration_rep>::contains(const point_rep& point) const
{
return ((point >= begin_) &&
@@ -216,7 +215,7 @@ namespace date_time {
//! True if this period fully contains (or equals) the other period
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
bool period<point_rep,duration_rep>::contains(const period<point_rep,duration_rep>& other) const
{
return ((begin_ <= other.begin_) && (last_ >= other.last_));
@@ -233,8 +232,9 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::is_adjacent(const period<point_rep,duration_rep>& other) const
inline
bool
period<point_rep,duration_rep>::is_adjacent(const period<point_rep,duration_rep>& other) const
{
return (other.begin() == end() ||
begin_ == other.end());
@@ -251,8 +251,9 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::is_after(const point_rep& t) const
inline
bool
period<point_rep,duration_rep>::is_after(const point_rep& t) const
{
if (is_null())
{
@@ -272,8 +273,9 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::is_before(const point_rep& t) const
inline
bool
period<point_rep,duration_rep>::is_before(const point_rep& t) const
{
if (is_null())
{
@@ -296,15 +298,17 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::intersects(const period<point_rep,duration_rep>& other) const
inline
bool period<point_rep,duration_rep>::intersects(const period<point_rep,duration_rep>& other) const
{
return !is_null() && !other.is_null() && (begin_ < other.end()) && (other.begin_ < end());
return ( contains(other.begin_) ||
other.contains(begin_) ||
((other.begin_ < begin_) && (other.last_ >= begin_)));
}
//! Returns the period of intersection or invalid range no intersection
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
period<point_rep,duration_rep>
period<point_rep,duration_rep>::intersection(const period<point_rep,duration_rep>& other) const
{
@@ -329,7 +333,7 @@ namespace date_time {
/*!
*/
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
period<point_rep,duration_rep>
period<point_rep,duration_rep>::merge(const period<point_rep,duration_rep>& other) const
{
@@ -356,7 +360,7 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline BOOST_CXX14_CONSTEXPR
inline
period<point_rep,duration_rep>
period<point_rep,duration_rep>::span(const period<point_rep,duration_rep>& other) const
{
+36 -40
View File
@@ -3,17 +3,14 @@
#define DATETIME_PERIOD_FORMATTER_HPP___
/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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$
*/
#include <iosfwd>
#include <string>
#include <vector>
#include <iterator>
namespace boost { namespace date_time {
@@ -22,14 +19,14 @@ namespace boost { namespace date_time {
/*! Provides settings for the following:
* - period_separator -- default '/'
* - period_open_start_delimeter -- default '['
* - period_open_range_end_delimeter -- default ')'
* - period_closed_range_end_delimeter -- default ']'
* - period_open_range_end_delimeter -- default ')'
* - period_closed_range_end_delimeter -- default ']'
* - display_as_open_range, display_as_closed_range -- default closed_range
*
* Thus the default formatting for a period is as follows:
*@code
* [period.start()/period.last()]
*@endcode
*@endcode
* So for a typical date_period this would be
*@code
* [2004-Jan-04/2004-Feb-01]
@@ -37,13 +34,13 @@ namespace boost { namespace date_time {
* where the date formatting is controlled by the date facet
*/
template <class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > >
class period_formatter {
class period_formatter {
public:
typedef std::basic_string<CharT> string_type;
typedef CharT char_type;
typedef typename std::basic_string<char_type>::const_iterator const_itr_type;
typedef std::vector<std::basic_string<CharT> > collection_type;
static const char_type default_period_separator[2];
static const char_type default_period_start_delimeter[2];
static const char_type default_period_open_range_end_delimeter[2];
@@ -52,8 +49,8 @@ namespace boost { namespace date_time {
enum range_display_options { AS_OPEN_RANGE, AS_CLOSED_RANGE };
//! Constructor that sets up period formatter options -- default should suffice most cases.
period_formatter(range_display_options range_option_in = AS_CLOSED_RANGE,
const char_type* const period_separator = default_period_separator,
period_formatter(range_display_options range_option_in = AS_CLOSED_RANGE,
const char_type* const period_separator = default_period_separator,
const char_type* const period_start_delimeter = default_period_start_delimeter,
const char_type* const period_open_range_end_delimeter = default_period_open_range_end_delimeter,
const char_type* const period_closed_range_end_delimeter = default_period_closed_range_end_delimeter) :
@@ -65,7 +62,7 @@ namespace boost { namespace date_time {
{}
//! Puts the characters between period elements into stream -- default is /
OutItrT put_period_separator(OutItrT& oitr) const
OutItrT put_period_separator(OutItrT& oitr) const
{
const_itr_type ci = m_period_separator.begin();
while (ci != m_period_separator.end()) {
@@ -76,7 +73,7 @@ namespace boost { namespace date_time {
}
//! Puts the period start characters into stream -- default is [
OutItrT put_period_start_delimeter(OutItrT& oitr) const
OutItrT put_period_start_delimeter(OutItrT& oitr) const
{
const_itr_type ci = m_period_start_delimeter.begin();
while (ci != m_period_start_delimeter.end()) {
@@ -87,9 +84,9 @@ namespace boost { namespace date_time {
}
//! Puts the period end characters into stream as controled by open/closed range setting.
OutItrT put_period_end_delimeter(OutItrT& oitr) const
OutItrT put_period_end_delimeter(OutItrT& oitr) const
{
const_itr_type ci, end;
if (m_range_option == AS_OPEN_RANGE) {
ci = m_open_range_end_delimeter.begin();
@@ -105,41 +102,40 @@ namespace boost { namespace date_time {
}
return oitr;
}
range_display_options range_option() const
{
return m_range_option;
}
//! Reset the range_option control
void
void
range_option(range_display_options option) const
{
m_range_option = option;
}
//! Change the delimiter strings
void delimiter_strings(const string_type& separator,
const string_type& start_delim,
const string_type& open_end_delim,
const string_type& closed_end_delim)
{
m_period_separator = separator;
m_period_start_delimeter = start_delim;
m_open_range_end_delimeter = open_end_delim;
m_closed_range_end_delimeter = closed_end_delim;
m_period_separator;
m_period_start_delimeter;
m_open_range_end_delimeter;
m_closed_range_end_delimeter;
}
//! Generic code to output a period -- no matter the period type.
/*! This generic code will output any period using a facet to
* to output the 'elements'. For example, in the case of a date_period
* the elements will be instances of a date which will be formatted
* the elements will be instances of a date which will be formatted
* according the to setup in the passed facet parameter.
*
*
* The steps for formatting a period are always the same:
* - put the start delimiter
* - put start element
* - put the separator
* - put the separator
* - put either last or end element depending on range settings
* - put end delimeter depending on range settings
*
@@ -152,9 +148,9 @@ namespace boost { namespace date_time {
*@endcode
*/
template<class period_type, class facet_type>
OutItrT put_period(OutItrT next,
std::ios_base& a_ios,
char_type a_fill,
OutItrT put_period(OutItrT next,
std::ios_base& a_ios,
char_type a_fill,
const period_type& p,
const facet_type& facet) const {
put_period_start_delimeter(next);
@@ -170,29 +166,29 @@ namespace boost { namespace date_time {
return next;
}
private:
range_display_options m_range_option;
range_display_options m_range_option;
string_type m_period_separator;
string_type m_period_start_delimeter;
string_type m_open_range_end_delimeter;
string_type m_closed_range_end_delimeter;
};
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
period_formatter<CharT, OutItrT>::default_period_separator[2] = {'/'};
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
period_formatter<CharT, OutItrT>::default_period_start_delimeter[2] = {'['};
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
period_formatter<CharT, OutItrT>::default_period_open_range_end_delimeter[2] = {')'};
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
period_formatter<CharT, OutItrT>::default_period_closed_range_end_delimeter[2] = {']'};
} } //namespace boost::date_time
+28 -27
View File
@@ -3,19 +3,14 @@
#define DATETIME_PERIOD_PARSER_HPP___
/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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$
*/
#include <ios>
#include <string>
#include <vector>
#include <iterator>
#include <boost/throw_exception.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/string_parse_tree.hpp>
#include <boost/date_time/string_convert.hpp>
@@ -23,12 +18,12 @@
namespace boost { namespace date_time {
//! Not a facet, but a class used to specify and control period parsing
//! Not a facet, but a class used to specify and control period parsing
/*! Provides settings for the following:
* - period_separator -- default '/'
* - period_open_start_delimeter -- default '['
* - period_open_range_end_delimeter -- default ')'
* - period_closed_range_end_delimeter -- default ']'
* - period_open_range_end_delimeter -- default ')'
* - period_closed_range_end_delimeter -- default ']'
* - display_as_open_range, display_as_closed_range -- default closed_range
*
* For a typical date_period, the contents of the input stream would be
@@ -69,6 +64,12 @@ namespace boost { namespace date_time {
delimiters.push_back(string_type(period_closed_range_end_delimeter));
}
period_parser(const period_parser<date_type,CharT>& p_parser)
{
this->delimiters = p_parser.delimiters;
this->m_range_option = p_parser.m_range_option;
}
period_range_option range_option() const
{
return m_range_option;
@@ -98,11 +99,11 @@ namespace boost { namespace date_time {
* to get the 'elements'. For example, in the case of a date_period
* the elements will be instances of a date which will be parsed
* according the to setup in the passed facet parameter.
*
*
* The steps for parsing a period are always the same:
* - consume the start delimiter
* - get start element
* - consume the separator
* - consume the separator
* - get either last or end element depending on range settings
* - consume the end delimeter depending on range settings
*
@@ -116,15 +117,15 @@ namespace boost { namespace date_time {
*@endcode
*/
template<class period_type, class duration_type, class facet_type>
period_type get_period(stream_itr_type& sitr,
period_type get_period(stream_itr_type& sitr,
stream_itr_type& stream_end,
std::ios_base& a_ios,
std::ios_base& a_ios,
const period_type& /* p */,
const duration_type& dur_unit,
const facet_type& facet) const
const facet_type& facet) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
typedef typename period_type::point_type point_type;
point_type p1(not_a_date_time), p2(not_a_date_time);
@@ -149,7 +150,7 @@ namespace boost { namespace date_time {
}
private:
collection_type delimiters;
collection_type delimiters;
period_range_option m_range_option;
enum delim_ids { SEPARATOR, START, OPEN_END, CLOSED_END };
@@ -159,10 +160,10 @@ namespace boost { namespace date_time {
stream_itr_type& stream_end,
const string_type& delim) const
{
/* string_parse_tree will not parse a string of punctuation characters
/* string_parse_tree will not parse a string of punctuation characters
* without knowing exactly how many characters to process
* Ex [2000. Will not parse out the '[' string without knowing
* to process only one character. By using length of the delimiter
* Ex [2000. Will not parse out the '[' string without knowing
* to process only one character. By using length of the delimiter
* string we can safely iterate past it. */
string_type s;
for(unsigned int i = 0; i < delim.length() && sitr != stream_end; ++i) {
@@ -176,20 +177,20 @@ namespace boost { namespace date_time {
}
};
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
period_parser<date_type, char_type>::default_period_separator[2] = {'/'};
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
period_parser<date_type, char_type>::default_period_start_delimeter[2] = {'['};
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
period_parser<date_type, char_type>::default_period_open_range_end_delimeter[2] = {')'};
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
period_parser<date_type, char_type>::default_period_closed_range_end_delimeter[2] = {']'};
} } //namespace boost::date_time
@@ -10,7 +10,6 @@
*/
#include <cstring>
#include <boost/cstdint.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <boost/date_time/filetime_functions.hpp>
@@ -22,18 +21,13 @@ namespace boost {
namespace posix_time {
//! Function that converts a time_t into a ptime.
inline
ptime from_time_t(std::time_t t)
{
return ptime(gregorian::date(1970,1,1)) + seconds(t);
}
//! Function that converts a ptime into a time_t
inline
std::time_t to_time_t(ptime pt)
{
return (pt - ptime(gregorian::date(1970,1,1))).total_seconds();
ptime start(gregorian::date(1970,1,1));
return start + seconds(static_cast<long>(t));
}
//! Convert a time to a tm structure truncating any fractional seconds
@@ -41,9 +35,9 @@ namespace posix_time {
std::tm to_tm(const boost::posix_time::ptime& t) {
std::tm timetm = boost::gregorian::to_tm(t.date());
boost::posix_time::time_duration td = t.time_of_day();
timetm.tm_hour = static_cast<int>(td.hours());
timetm.tm_min = static_cast<int>(td.minutes());
timetm.tm_sec = static_cast<int>(td.seconds());
timetm.tm_hour = td.hours();
timetm.tm_min = td.minutes();
timetm.tm_sec = td.seconds();
timetm.tm_isdst = -1; // -1 used when dst info is unknown
return timetm;
}
@@ -52,9 +46,9 @@ namespace posix_time {
std::tm to_tm(const boost::posix_time::time_duration& td) {
std::tm timetm;
std::memset(&timetm, 0, sizeof(timetm));
timetm.tm_hour = static_cast<int>(date_time::absolute_value(td.hours()));
timetm.tm_min = static_cast<int>(date_time::absolute_value(td.minutes()));
timetm.tm_sec = static_cast<int>(date_time::absolute_value(td.seconds()));
timetm.tm_hour = date_time::absolute_value(td.hours());
timetm.tm_min = date_time::absolute_value(td.minutes());
timetm.tm_sec = date_time::absolute_value(td.seconds());
timetm.tm_isdst = -1; // -1 used when dst info is unknown
return timetm;
}
@@ -80,7 +74,7 @@ namespace posix_time {
*
* \note The function is templated on the FILETIME type, so that
* it can be used with both native FILETIME and the ad-hoc
* boost::detail::winapi::FILETIME_ type.
* boost::date_time::winapi::file_time type.
*/
template< typename TimeT, typename FileTimeT >
inline
@@ -1,6 +1,6 @@
#ifndef DATE_DURATION_OPERATORS_HPP___
#define DATE_DURATION_OPERATORS_HPP___
/* Copyright (c) 2004 CrystalClear Software, Inc.
* Subject to the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or
@@ -26,7 +26,7 @@ namespace posix_time {
/*! Adds a months object and a ptime. Result will be same
* day-of-month as ptime unless original day was the last day of month.
* see date_time::months_duration for more details */
inline BOOST_CXX14_CONSTEXPR
inline
ptime
operator+(const ptime& t, const boost::gregorian::months& m)
{
@@ -36,7 +36,7 @@ namespace posix_time {
/*! Adds a months object to a ptime. Result will be same
* day-of-month as ptime unless original day was the last day of month.
* see date_time::months_duration for more details */
inline BOOST_CXX14_CONSTEXPR
inline
ptime
operator+=(ptime& t, const boost::gregorian::months& m)
{
@@ -47,7 +47,7 @@ namespace posix_time {
/*! Subtracts a months object and a ptime. Result will be same
* day-of-month as ptime unless original day was the last day of month.
* see date_time::months_duration for more details */
inline BOOST_CXX14_CONSTEXPR
inline
ptime
operator-(const ptime& t, const boost::gregorian::months& m)
{
@@ -58,7 +58,7 @@ namespace posix_time {
/*! Subtracts a months object from a ptime. Result will be same
* day-of-month as ptime unless original day was the last day of month.
* see date_time::months_duration for more details */
inline BOOST_CXX14_CONSTEXPR
inline
ptime
operator-=(ptime& t, const boost::gregorian::months& m)
{
@@ -70,7 +70,7 @@ namespace posix_time {
/*! Adds a years object and a ptime. Result will be same
* month and day-of-month as ptime unless original day was the
* last day of month. see date_time::years_duration for more details */
inline BOOST_CXX14_CONSTEXPR
inline
ptime
operator+(const ptime& t, const boost::gregorian::years& y)
{
@@ -80,7 +80,7 @@ namespace posix_time {
/*! Adds a years object to a ptime. Result will be same
* month and day-of-month as ptime unless original day was the
* last day of month. see date_time::years_duration for more details */
inline BOOST_CXX14_CONSTEXPR
inline
ptime
operator+=(ptime& t, const boost::gregorian::years& y)
{
@@ -90,7 +90,7 @@ namespace posix_time {
/*! Subtracts a years object and a ptime. Result will be same
* month and day-of-month as ptime unless original day was the
* last day of month. see date_time::years_duration for more details */
inline BOOST_CXX14_CONSTEXPR
inline
ptime
operator-(const ptime& t, const boost::gregorian::years& y)
{
@@ -101,7 +101,7 @@ namespace posix_time {
/*! Subtracts a years object from a ptime. Result will be same
* month and day-of-month as ptime unless original day was the
* last day of month. see date_time::years_duration for more details */
inline BOOST_CXX14_CONSTEXPR
inline
ptime
operator-=(ptime& t, const boost::gregorian::years& y)
{
@@ -1,7 +1,7 @@
#ifndef POSIX_TIME_CONFIG_HPP___
#define POSIX_TIME_CONFIG_HPP___
/* Copyright (c) 2002,2003,2005,2020 CrystalClear Software, Inc.
/* 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)
@@ -22,26 +22,39 @@
namespace boost {
namespace posix_time {
//Remove the following line if you want 64 bit millisecond resolution time
//#define BOOST_GDTL_POSIX_TIME_STD_CONFIG
#ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
// set up conditional test compilations
#define BOOST_DATE_TIME_HAS_MILLISECONDS
#define BOOST_DATE_TIME_HAS_MICROSECONDS
#define BOOST_DATE_TIME_HAS_NANOSECONDS
typedef date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::nano,
1000000000, 9 > time_res_traits;
#else
// set up conditional test compilations
#define BOOST_DATE_TIME_HAS_MILLISECONDS
#define BOOST_DATE_TIME_HAS_MICROSECONDS
#undef BOOST_DATE_TIME_HAS_NANOSECONDS
typedef date_time::time_resolution_traits<
boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::micro,
1000000, 6 > time_res_traits;
// #undef BOOST_DATE_TIME_HAS_MILLISECONDS
// #undef BOOST_DATE_TIME_HAS_MICROSECONDS
// #undef BOOST_DATE_TIME_HAS_NANOSECONDS
// typedef date_time::time_resolution_traits<boost::int64_t, boost::date_time::tenth,
// 10, 0 > time_res_traits;
#endif
//! Base time duration type
/*! \ingroup time_basics
*/
class BOOST_SYMBOL_VISIBLE time_duration :
class time_duration :
public date_time::time_duration<time_duration, time_res_traits>
{
public:
@@ -53,23 +66,23 @@ namespace posix_time {
typedef time_res_traits::fractional_seconds_type fractional_seconds_type;
typedef time_res_traits::tick_type tick_type;
typedef time_res_traits::impl_type impl_type;
BOOST_CXX14_CONSTEXPR time_duration(hour_type hour,
min_type min,
sec_type sec,
fractional_seconds_type fs=0) :
time_duration(hour_type hour,
min_type min,
sec_type sec,
fractional_seconds_type fs=0) :
date_time::time_duration<time_duration, time_res_traits>(hour,min,sec,fs)
{}
BOOST_CXX14_CONSTEXPR time_duration() :
time_duration() :
date_time::time_duration<time_duration, time_res_traits>(0,0,0)
{}
//! Construct from special_values
BOOST_CXX14_CONSTEXPR time_duration(boost::date_time::special_values sv) :
time_duration(boost::date_time::special_values sv) :
date_time::time_duration<time_duration, time_res_traits>(sv)
{}
//Give duration access to ticks constructor -- hide from users
friend class date_time::time_duration<time_duration, time_res_traits>;
protected:
BOOST_CXX14_CONSTEXPR explicit time_duration(impl_type tick_count) :
private:
explicit time_duration(impl_type tick_count) :
date_time::time_duration<time_duration, time_res_traits>(tick_count)
{}
};
@@ -81,7 +94,7 @@ namespace posix_time {
{
typedef gregorian::date date_type;
typedef time_duration time_duration_type;
BOOST_CXX14_CONSTEXPR simple_time_rep(date_type d, time_duration_type tod) :
simple_time_rep(date_type d, time_duration_type tod) :
day(d),
time_of_day(tod)
{
@@ -103,25 +116,25 @@ namespace posix_time {
}
date_type day;
time_duration_type time_of_day;
BOOST_CXX14_CONSTEXPR bool is_special()const
bool is_special()const
{
return(is_pos_infinity() || is_neg_infinity() || is_not_a_date_time());
}
BOOST_CXX14_CONSTEXPR bool is_pos_infinity()const
bool is_pos_infinity()const
{
return(day.is_pos_infinity() || time_of_day.is_pos_infinity());
}
BOOST_CXX14_CONSTEXPR bool is_neg_infinity()const
bool is_neg_infinity()const
{
return(day.is_neg_infinity() || time_of_day.is_neg_infinity());
}
BOOST_CXX14_CONSTEXPR bool is_not_a_date_time()const
bool is_not_a_date_time()const
{
return(day.is_not_a_date() || time_of_day.is_not_a_date_time());
}
};
class BOOST_SYMBOL_VISIBLE posix_time_system_config
class posix_time_system_config
{
public:
typedef simple_time_rep time_rep_type;
@@ -1,7 +1,7 @@
#ifndef POSIX_TIME_DURATION_HPP___
#define POSIX_TIME_DURATION_HPP___
/* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003 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)
@@ -9,54 +9,41 @@
* $Date$
*/
#include <boost/core/enable_if.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/posix_time/posix_time_config.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/type_traits/is_integral.hpp>
#include "boost/date_time/posix_time/posix_time_config.hpp"
namespace boost {
namespace posix_time {
//! Allows expression of durations as an hour count
//! The argument must be an integral type
/*! \ingroup time_basics
*/
class BOOST_SYMBOL_VISIBLE hours : public time_duration
class hours : public time_duration
{
public:
template <typename T>
BOOST_CXX14_CONSTEXPR explicit hours(T const& h,
typename boost::enable_if<boost::is_integral<T>, void>::type* = BOOST_DATE_TIME_NULLPTR) :
time_duration(numeric_cast<hour_type>(h), 0, 0)
explicit hours(long h) :
time_duration(h,0,0)
{}
};
//! Allows expression of durations as a minute count
//! The argument must be an integral type
/*! \ingroup time_basics
*/
class BOOST_SYMBOL_VISIBLE minutes : public time_duration
class minutes : public time_duration
{
public:
template <typename T>
BOOST_CXX14_CONSTEXPR explicit minutes(T const& m,
typename boost::enable_if<boost::is_integral<T>, void>::type* = BOOST_DATE_TIME_NULLPTR) :
time_duration(0, numeric_cast<min_type>(m),0)
explicit minutes(long m) :
time_duration(0,m,0)
{}
};
//! Allows expression of durations as a seconds count
//! The argument must be an integral type
/*! \ingroup time_basics
*/
class BOOST_SYMBOL_VISIBLE seconds : public time_duration
class seconds : public time_duration
{
public:
template <typename T>
BOOST_CXX14_CONSTEXPR explicit seconds(T const& s,
typename boost::enable_if<boost::is_integral<T>, void>::type* = BOOST_DATE_TIME_NULLPTR) :
time_duration(0,0, numeric_cast<sec_type>(s))
explicit seconds(long s) :
time_duration(0,0,s)
{}
};
@@ -82,8 +69,12 @@ namespace posix_time {
typedef date_time::subsecond_duration<time_duration,1000000000> nanosec;
typedef date_time::subsecond_duration<time_duration,1000000000> nanoseconds;
#endif
} }//namespace posix_time
@@ -47,6 +47,7 @@ namespace posix_time {
const ptime& p) {
boost::io::ios_flags_saver iflags(os);
typedef boost::date_time::time_facet<ptime, CharT> custom_ptime_facet;
typedef std::time_put<CharT> std_ptime_facet;
std::ostreambuf_iterator<CharT> oitr(os);
if (std::has_facet<custom_ptime_facet>(os.getloc()))
std::use_facet<custom_ptime_facet>(os.getloc()).put(oitr, os, os.fill(), p);
@@ -74,13 +75,13 @@ namespace posix_time {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet_local;
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<time_input_facet_local>(is.getloc())) {
std::use_facet<time_input_facet_local>(is.getloc()).get(sit, str_end, is, pt);
if(std::has_facet<time_input_facet>(is.getloc())) {
std::use_facet<time_input_facet>(is.getloc()).get(sit, str_end, is, pt);
}
else {
time_input_facet_local* f = new time_input_facet_local();
time_input_facet* f = new time_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, pt);
@@ -97,7 +98,7 @@ namespace posix_time {
throw; // rethrow original exception
}
else {
// if the user wants to fail quietly, we simply set the failbit
// if the user want's to fail quietly, we simply set the failbit
is.setstate(std::ios_base::failbit);
}
}
@@ -113,6 +114,7 @@ namespace posix_time {
const boost::posix_time::time_period& p) {
boost::io::ios_flags_saver iflags(os);
typedef boost::date_time::time_facet<ptime, CharT> custom_ptime_facet;
typedef std::time_put<CharT> std_time_facet;
std::ostreambuf_iterator<CharT> oitr(os);
if (std::has_facet<custom_ptime_facet>(os.getloc())) {
std::use_facet<custom_ptime_facet>(os.getloc()).put(oitr, os, os.fill(), p);
@@ -141,13 +143,13 @@ namespace posix_time {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet_local;
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<time_input_facet_local>(is.getloc())) {
std::use_facet<time_input_facet_local>(is.getloc()).get(sit, str_end, is, tp);
if(std::has_facet<time_input_facet>(is.getloc())) {
std::use_facet<time_input_facet>(is.getloc()).get(sit, str_end, is, tp);
}
else {
time_input_facet_local* f = new time_input_facet_local();
time_input_facet* f = new time_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, tp);
@@ -178,6 +180,7 @@ namespace posix_time {
{
boost::io::ios_flags_saver iflags(os);
typedef boost::date_time::time_facet<ptime, CharT> custom_ptime_facet;
typedef std::time_put<CharT> std_ptime_facet;
std::ostreambuf_iterator<CharT> oitr(os);
if (std::has_facet<custom_ptime_facet>(os.getloc()))
std::use_facet<custom_ptime_facet>(os.getloc()).put(oitr, os, os.fill(), td);
@@ -205,13 +208,13 @@ namespace posix_time {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet_local;
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<time_input_facet_local>(is.getloc())) {
std::use_facet<time_input_facet_local>(is.getloc()).get(sit, str_end, is, td);
if(std::has_facet<time_input_facet>(is.getloc())) {
std::use_facet<time_input_facet>(is.getloc()).get(sit, str_end, is, td);
}
else {
time_input_facet_local* f = new time_input_facet_local();
time_input_facet* f = new time_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, td);
@@ -80,7 +80,7 @@ namespace posix_time {
// any marker (such as '\0').
typename std::basic_string<charT>::iterator e = inp_s.end();
while(b != e){
out_ss << is.narrow(*b, 0);
out_ss << out_ss.narrow(*b, 0);
++b;
}
+9 -28
View File
@@ -9,9 +9,8 @@
* $Date$
*/
#include <boost/date_time/posix_time/posix_time_system.hpp>
#include <boost/date_time/time.hpp>
#include <boost/date_time/compiler_config.hpp>
#include "boost/date_time/posix_time/posix_time_system.hpp"
#include "boost/date_time/time.hpp"
namespace boost {
@@ -25,11 +24,11 @@ namespace posix_time {
using date_time::not_a_date_time;
using date_time::max_date_time;
using date_time::min_date_time;
//! Time type with no timezone or other adjustments
/*! \ingroup time_basics
*/
class BOOST_SYMBOL_VISIBLE ptime : public date_time::base_time<ptime, posix_time_system>
class ptime : public date_time::base_time<ptime, posix_time_system>
{
public:
typedef posix_time_system time_system_type;
@@ -37,44 +36,26 @@ namespace posix_time {
typedef time_system_type::time_duration_type time_duration_type;
typedef ptime time_type;
//! Construct with date and offset in day
BOOST_CXX14_CONSTEXPR
ptime(gregorian::date d,time_duration_type td) :
date_time::base_time<time_type,time_system_type>(d,td)
ptime(gregorian::date d,time_duration_type td) : date_time::base_time<time_type,time_system_type>(d,td)
{}
//! Construct a time at start of the given day (midnight)
BOOST_CXX14_CONSTEXPR
explicit ptime(gregorian::date d) :
date_time::base_time<time_type,time_system_type>(d,time_duration_type(0,0,0))
explicit ptime(gregorian::date d) : date_time::base_time<time_type,time_system_type>(d,time_duration_type(0,0,0))
{}
//! Copy from time_rep
BOOST_CXX14_CONSTEXPR
ptime(const time_rep_type& rhs):
date_time::base_time<time_type,time_system_type>(rhs)
{}
//! Construct from special value
BOOST_CXX14_CONSTEXPR
ptime(const special_values sv) :
date_time::base_time<time_type,time_system_type>(sv)
ptime(const special_values sv) : date_time::base_time<time_type,time_system_type>(sv)
{}
#if !defined(DATE_TIME_NO_DEFAULT_CONSTRUCTOR)
// Default constructor constructs to not_a_date_time
BOOST_CXX14_CONSTEXPR
ptime() :
date_time::base_time<time_type,time_system_type>(gregorian::date(not_a_date_time),
time_duration_type(not_a_date_time))
ptime() : date_time::base_time<time_type,time_system_type>(gregorian::date(not_a_date_time), time_duration_type(not_a_date_time))
{}
#endif // DATE_TIME_NO_DEFAULT_CONSTRUCTOR
friend BOOST_CXX14_CONSTEXPR
bool operator==(const ptime& lhs, const ptime& rhs);
};
inline BOOST_CXX14_CONSTEXPR
bool operator==(const ptime& lhs, const ptime& rhs)
{
return ptime::time_system_type::is_equal(lhs.time_,rhs.time_);
}
} }//namespace posix_time
@@ -157,7 +157,7 @@ namespace posix_time {
}// else
return ss.str();
}
//! Time duration in ISO 8601 format -hhmmss.fffffff. Example: 10:09:03.0123456
//! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456
/*!\ingroup time_format
*/
inline std::string to_iso_string(time_duration td){
@@ -215,7 +215,7 @@ namespace posix_time {
return ts;
}
}
//! Convert ISO 8601 short form YYYYMMDDTHHMMSS where T is the date-time separator
//! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator
/*!\ingroup time_format
*/
inline std::string to_iso_string(ptime t){
@@ -251,7 +251,7 @@ namespace posix_time {
inline std::wstring to_simple_wstring(time_duration td) {
return to_simple_string_type<wchar_t>(td);
}
//! Time duration in ISO 8601 format -hhmmss.fffffff. Example: 10:09:03.0123456
//! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456
/*!\ingroup time_format
*/
inline std::wstring to_iso_wstring(time_duration td){
@@ -266,7 +266,7 @@ namespace posix_time {
inline std::wstring to_simple_wstring(time_period tp){
return to_simple_string_type<wchar_t>(tp);
}
//! Convert ISO 8601 short form YYYYMMDDTHHMMSS where T is the date-time separator
//! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator
/*!\ingroup time_format
*/
inline std::wstring to_iso_wstring(ptime t){
@@ -82,7 +82,7 @@ namespace posix_time {
return ss.str();
}
//! Time duration in ISO 8601 format -hhmmss.fffffff. Example: 10:09:03.0123456
//! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456
/*!\ingroup time_format
*/
inline
@@ -173,7 +173,7 @@ namespace posix_time {
return std::string("[" + d1 + "/" + d2 +"]");
}
//! Convert ISO 8601 short form YYYYMMDDTHHMMSS where T is the date-time separator
//! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator
/*!\ingroup time_format
*/
inline
@@ -35,14 +35,6 @@ namespace posix_time {
return date_time::parse_iso_time<ptime>(s, 'T');
}
inline ptime from_iso_extended_string(const std::string& s) {
if (s.size() == 10) { //assume we just have a date which is 10 chars
gregorian::date d = gregorian::from_simple_string(s);
return ptime( d );
}
return date_time::parse_delimited_time<ptime>(s, 'T');
}
} } //namespace posix_time
@@ -11,45 +11,20 @@
#include "boost/date_time/posix_time/posix_time.hpp"
#include "boost/date_time/gregorian/greg_serialize.hpp"
#include "boost/core/nvp.hpp"
#include "boost/numeric/conversion/cast.hpp"
#include "boost/type_traits/integral_constant.hpp"
#include "boost/serialization/split_free.hpp"
#include "boost/serialization/nvp.hpp"
// Define versions for serialization compatibility
// alows the unit tests to make an older version to check compatibility
#ifndef BOOST_DATE_TIME_POSIX_TIME_DURATION_VERSION
#define BOOST_DATE_TIME_POSIX_TIME_DURATION_VERSION 1
#endif
// macros to split serialize functions into save & load functions
// NOTE: these macros define template functions in the boost::serialization namespace.
// They must be expanded *outside* of any namespace
BOOST_SERIALIZATION_SPLIT_FREE(boost::posix_time::ptime)
BOOST_SERIALIZATION_SPLIT_FREE(boost::posix_time::time_duration)
BOOST_SERIALIZATION_SPLIT_FREE(boost::posix_time::time_period)
namespace boost {
namespace serialization {
template<typename T>
struct version;
template<>
struct version<boost::posix_time::time_duration>
: integral_constant<int, BOOST_DATE_TIME_POSIX_TIME_DURATION_VERSION>
{
};
// A macro to split serialize functions into save & load functions.
// It is here to avoid dependency on Boost.Serialization just for the
// BOOST_SERIALIZATION_SPLIT_FREE macro
#define BOOST_DATE_TIME_SPLIT_FREE(T) \
template<class Archive> \
inline void serialize(Archive & ar, \
T & t, \
const unsigned int file_version) \
{ \
split_free(ar, t, file_version); \
}
BOOST_DATE_TIME_SPLIT_FREE(boost::posix_time::ptime)
BOOST_DATE_TIME_SPLIT_FREE(boost::posix_time::time_duration)
BOOST_DATE_TIME_SPLIT_FREE(boost::posix_time::time_period)
#undef BOOST_DATE_TIME_SPLIT_FREE
/*** time_duration ***/
@@ -58,23 +33,10 @@ BOOST_DATE_TIME_SPLIT_FREE(boost::posix_time::time_period)
* types are hour_type, min_type, sec_type, and fractional_seconds_type
* as defined in the time_duration class
*/
template<class TimeResTraitsSize, class Archive>
void save_td(Archive& ar, const posix_time::time_duration& td)
{
TimeResTraitsSize h = boost::numeric_cast<TimeResTraitsSize>(td.hours());
TimeResTraitsSize m = boost::numeric_cast<TimeResTraitsSize>(td.minutes());
TimeResTraitsSize s = boost::numeric_cast<TimeResTraitsSize>(td.seconds());
posix_time::time_duration::fractional_seconds_type fs = td.fractional_seconds();
ar & make_nvp("time_duration_hours", h);
ar & make_nvp("time_duration_minutes", m);
ar & make_nvp("time_duration_seconds", s);
ar & make_nvp("time_duration_fractional_seconds", fs);
}
template<class Archive>
void save(Archive & ar,
const posix_time::time_duration& td,
unsigned int version)
unsigned int /*version*/)
{
// serialize a bool so we know how to read this back in later
bool is_special = td.is_special();
@@ -84,13 +46,14 @@ void save(Archive & ar,
ar & make_nvp("sv_time_duration", s);
}
else {
// Write support for earlier versions allows for upgrade compatibility testing
// See load comments for version information
if (version == 0) {
save_td<int32_t>(ar, td);
} else {
save_td<int64_t>(ar, td);
}
typename posix_time::time_duration::hour_type h = td.hours();
typename posix_time::time_duration::min_type m = td.minutes();
typename posix_time::time_duration::sec_type s = td.seconds();
typename posix_time::time_duration::fractional_seconds_type fs = td.fractional_seconds();
ar & make_nvp("time_duration_hours", h);
ar & make_nvp("time_duration_minutes", m);
ar & make_nvp("time_duration_seconds", s);
ar & make_nvp("time_duration_fractional_seconds", fs);
}
}
@@ -99,24 +62,10 @@ void save(Archive & ar,
* types are hour_type, min_type, sec_type, and fractional_seconds_type
* as defined in the time_duration class
*/
template<class TimeResTraitsSize, class Archive>
void load_td(Archive& ar, posix_time::time_duration& td)
{
TimeResTraitsSize h(0);
TimeResTraitsSize m(0);
TimeResTraitsSize s(0);
posix_time::time_duration::fractional_seconds_type fs(0);
ar & make_nvp("time_duration_hours", h);
ar & make_nvp("time_duration_minutes", m);
ar & make_nvp("time_duration_seconds", s);
ar & make_nvp("time_duration_fractional_seconds", fs);
td = posix_time::time_duration(h, m, s, fs);
}
template<class Archive>
void load(Archive & ar,
posix_time::time_duration & td,
unsigned int version)
unsigned int /*version*/)
{
bool is_special = false;
ar & make_nvp("is_special", is_special);
@@ -127,25 +76,15 @@ void load(Archive & ar,
td = posix_time::time_duration(sv);
}
else {
// Version "0" (Boost 1.65.1 or earlier, which used int32_t for day/hour/minute/second and
// therefore suffered from the year 2038 issue.)
// Version "0.5" (Boost 1.66.0 changed to std::time_t but did not increase the version;
// it was missed in the original change, all code reviews, and there were no
// static assertions to protect the code; further std::time_t can be 32-bit
// or 64-bit so it reduced portability. This makes 1.66.0 hard to handle...)
// Version "1" (Boost 1.67.0 or later uses int64_t and is properly versioned)
// If the size of any of these items changes, a new version is needed.
BOOST_STATIC_ASSERT(sizeof(posix_time::time_duration::hour_type) == sizeof(boost::int64_t));
BOOST_STATIC_ASSERT(sizeof(posix_time::time_duration::min_type) == sizeof(boost::int64_t));
BOOST_STATIC_ASSERT(sizeof(posix_time::time_duration::sec_type) == sizeof(boost::int64_t));
BOOST_STATIC_ASSERT(sizeof(posix_time::time_duration::fractional_seconds_type) == sizeof(boost::int64_t));
if (version == 0) {
load_td<int32_t>(ar, td);
} else {
load_td<int64_t>(ar, td);
}
typename posix_time::time_duration::hour_type h(0);
typename posix_time::time_duration::min_type m(0);
typename posix_time::time_duration::sec_type s(0);
typename posix_time::time_duration::fractional_seconds_type fs(0);
ar & make_nvp("time_duration_hours", h);
ar & make_nvp("time_duration_minutes", m);
ar & make_nvp("time_duration_seconds", s);
ar & make_nvp("time_duration_fractional_seconds", fs);
td = posix_time::time_duration(h,m,s,fs);
}
}
@@ -165,10 +104,10 @@ void save(Archive & ar,
{
// from_iso_string does not include fractional seconds
// therefore date and time_duration are used
posix_time::ptime::date_type d = pt.date();
typename posix_time::ptime::date_type d = pt.date();
ar & make_nvp("ptime_date", d);
if(!pt.is_special()) {
posix_time::ptime::time_duration_type td = pt.time_of_day();
typename posix_time::ptime::time_duration_type td = pt.time_of_day();
ar & make_nvp("ptime_time_duration", td);
}
}
@@ -184,8 +123,8 @@ void load(Archive & ar,
{
// from_iso_string does not include fractional seconds
// therefore date and time_duration are used
posix_time::ptime::date_type d(posix_time::not_a_date_time);
posix_time::ptime::time_duration_type td;
typename posix_time::ptime::date_type d(posix_time::not_a_date_time);
typename posix_time::ptime::time_duration_type td;
ar & make_nvp("ptime_date", d);
if(!d.is_special()) {
ar & make_nvp("ptime_time_duration", td);
@@ -245,7 +184,7 @@ void load(Archive & ar,
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/,
inline void load_construct_data(Archive & ar,
boost::posix_time::time_period* tp,
const unsigned int /*file_version*/)
{
@@ -12,7 +12,6 @@
#include <vector>
#include <string>
#include <iterator>
#include "boost/date_time/special_defs.hpp"
namespace boost { namespace date_time {
@@ -34,9 +34,14 @@ namespace boost { namespace date_time {
{
public:
typedef std::basic_string<charT> string_type;
typedef std::basic_stringstream<charT> stringstream_type;
//typedef std::basic_stringstream<charT> stringstream_type;
typedef std::istreambuf_iterator<charT> stream_itr_type;
//typedef typename string_type::const_iterator const_itr;
//typedef typename date_type::year_type year_type;
//typedef typename date_type::month_type month_type;
typedef typename date_type::duration_type duration_type;
//typedef typename date_type::day_of_week_type day_of_week_type;
//typedef typename date_type::day_type day_type;
typedef string_parse_tree<charT> parse_tree_type;
typedef typename parse_tree_type::parse_match_result_type match_results;
typedef std::vector<std::basic_string<charT> > collection_type;
@@ -75,6 +80,11 @@ namespace boost { namespace date_time {
m_sv_strings = parse_tree_type(phrases, static_cast<int>(not_a_date_time));
}
special_values_parser(const special_values_parser<date_type,charT>& svp)
{
this->m_sv_strings = svp.m_sv_strings;
}
//! Replace special value strings
void sv_strings(const string_type& nadt_str,
const string_type& neg_inf_str,
@@ -91,37 +101,11 @@ namespace boost { namespace date_time {
m_sv_strings = parse_tree_type(phrases, static_cast<int>(not_a_date_time));
}
//! The parser is expensive to create, and not thread-safe so it cannot be static
//! therefore given a string, determine if it is likely to be a special value.
//! A negative response is a definite no, whereas a positive is only likely and
//! match() should be called and return value checked.
//! \param[in] str the string to check
//! \returns false if it is definitely not a special value
static bool should_call_match(const string_type& str)
{
if (!str.empty()) {
switch (str[0]) {
// See string definitions at the end of this class..
case '+':
case '-':
case 'n':
case 'm':
return true;
default:
break;
}
}
return false;
}
//! Given an input iterator, attempt to match it to a known special value
//! \param[in] sitr the start iterator
//! \param[in] str_end the end iterator
//! \param[out] mr the match result:
//! mr.current_match is set to the corresponding special_value or -1
//! \returns whether something matched
/* Does not return a special_value because if the parsing fails,
* the return value will always be not_a_date_time
* (mr.current_match retains its default value of -1 on a failed
* parse and that casts to not_a_date_time). */
//! Sets match_results.current_match to the corresponding special_value or -1
bool match(stream_itr_type& sitr,
stream_itr_type& str_end,
match_results& mr) const
@@ -130,6 +114,18 @@ namespace boost { namespace date_time {
m_sv_strings.match(sitr, str_end, mr, level);
return (mr.current_match != match_results::PARSE_ERROR);
}
/*special_values match(stream_itr_type& sitr,
stream_itr_type& str_end,
match_results& mr) const
{
unsigned int level = 0;
m_sv_strings.match(sitr, str_end, mr, level);
if(mr.current_match == match_results::PARSE_ERROR) {
throw std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'");
}
return static_cast<special_values>(mr.current_match);
}*/
private:
parse_tree_type m_sv_strings;
@@ -21,6 +21,7 @@ namespace date_time {
inline
std::basic_string<OutputT> convert_string_type(const std::basic_string<InputT>& inp_str)
{
typedef std::basic_string<InputT> input_type;
typedef std::basic_string<OutputT> output_type;
output_type result;
result.insert(result.begin(), inp_str.begin(), inp_str.end());
+8 -11
View File
@@ -10,13 +10,11 @@
*/
#include <boost/algorithm/string/case_conv.hpp>
#include <cctype>
#include "boost/lexical_cast.hpp" //error without?
#include "boost/algorithm/string/case_conv.hpp"
#include <map>
#include <string>
#include <vector>
#include <ostream>
#include <iterator>
#include <algorithm>
namespace boost { namespace date_time {
@@ -27,7 +25,7 @@ struct parse_match_result
{
parse_match_result() :
match_depth(0),
current_match(PARSE_ERROR)
current_match(-1)// -1 is match_not-found value
{}
typedef std::basic_string<charT> string_type;
string_type remaining() const
@@ -35,7 +33,7 @@ struct parse_match_result
if (match_depth == cache.size()) {
return string_type();
}
if (current_match == PARSE_ERROR) {
if (current_match == -1) {
return cache;
}
//some of the cache was used return the rest
@@ -58,7 +56,7 @@ struct parse_match_result
string_type cache;
unsigned short match_depth;
short current_match;
enum PARSE_STATE { PARSE_ERROR = -1 };
enum PARSE_STATE { PARSE_ERROR= -1 };
};
//for debug -- really only char streams...
@@ -84,7 +82,7 @@ operator<<(std::basic_ostream<charT>& os, parse_match_result<charT>& mr)
template<typename charT>
struct string_parse_tree
{
#if BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) )
#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) )
typedef std::multimap<charT, string_parse_tree< charT> > ptree_coll;
#else
typedef std::multimap<charT, string_parse_tree > ptree_coll;
@@ -101,8 +99,7 @@ struct string_parse_tree
* (Sun=0, Mon=1, ...) were a starting_point of one starts the
* numbering at one (Jan=1, Feb=2, ...). The default is zero,
* negative vaules are not allowed */
string_parse_tree(collection_type names, unsigned int starting_point=0) :
m_value(parse_match_result_type::PARSE_ERROR)
string_parse_tree(collection_type names, unsigned int starting_point=0)
{
// iterate thru all the elements and build the tree
unsigned short index = 0;
@@ -116,7 +113,7 @@ struct string_parse_tree
}
string_parse_tree(short value = parse_match_result_type::PARSE_ERROR) :
string_parse_tree(short value = -1) :
m_value(value)
{}
ptree_coll m_next_chars;
@@ -9,12 +9,10 @@
* $Date$
*/
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <locale>
#include <iterator>
namespace boost { namespace date_time {
@@ -37,6 +35,7 @@ gather_month_strings(const std::locale& locale, bool short_strings=true)
{
typedef std::basic_string<charT> string_type;
typedef std::vector<string_type> collection_type;
typedef std::basic_ostringstream<charT> ostream_type;
typedef std::ostreambuf_iterator<charT> ostream_iter_type;
typedef std::basic_ostringstream<charT> stringstream_type;
typedef std::time_put<charT> time_put_facet_type;
@@ -51,9 +50,8 @@ gather_month_strings(const std::locale& locale, bool short_strings=true)
//grab the needed strings by using the locale to
//output each month
const charT* p_outfmt = outfmt.c_str(), *p_outfmt_end = p_outfmt + outfmt.size();
tm tm_value;
std::memset(&tm_value, 0, sizeof(tm_value));
for (int m=0; m < 12; m++) {
tm tm_value;
tm_value.tm_mon = m;
stringstream_type ss;
ostream_iter_type oitr(ss);
@@ -87,6 +85,7 @@ gather_weekday_strings(const std::locale& locale, bool short_strings=true)
{
typedef std::basic_string<charT> string_type;
typedef std::vector<string_type> collection_type;
typedef std::basic_ostringstream<charT> ostream_type;
typedef std::ostreambuf_iterator<charT> ostream_iter_type;
typedef std::basic_ostringstream<charT> stringstream_type;
typedef std::time_put<charT> time_put_facet_type;
@@ -104,9 +103,8 @@ gather_weekday_strings(const std::locale& locale, bool short_strings=true)
//grab the needed strings by using the locale to
//output each month / weekday
const charT* p_outfmt = outfmt.c_str(), *p_outfmt_end = p_outfmt + outfmt.size();
tm tm_value;
std::memset(&tm_value, 0, sizeof(tm_value));
for (int i=0; i < 7; i++) {
tm tm_value;
tm_value.tm_wday = i;
stringstream_type ss;
ostream_iter_type oitr(ss);
+3 -26
View File
@@ -1,7 +1,7 @@
#ifndef DATE_TIME_TIME_HPP___
#define DATE_TIME_TIME_HPP___
/* Copyright (c) 2002,2003,2005,2020 CrystalClear Software, Inc.
/* 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)
@@ -49,8 +49,6 @@ namespace date_time {
> >
{
public:
// A tag for type categorization. Can be used to detect Boost.DateTime time points in generic code.
typedef void _is_boost_date_time_time_point;
typedef T time_type;
typedef typename time_system::time_rep_type time_rep_type;
typedef typename time_system::date_type date_type;
@@ -58,26 +56,21 @@ namespace date_time {
typedef typename time_system::time_duration_type time_duration_type;
//typedef typename time_system::hms_type hms_type;
BOOST_CXX14_CONSTEXPR
base_time(const date_type& day,
const time_duration_type& td,
dst_flags dst=not_dst) :
time_(time_system::get_time_rep(day, td, dst))
{}
BOOST_CXX14_CONSTEXPR
base_time(special_values sv) :
time_(time_system::get_time_rep(sv))
{}
BOOST_CXX14_CONSTEXPR
base_time(const time_rep_type& rhs) :
time_(rhs)
{}
BOOST_CXX14_CONSTEXPR
date_type date() const
{
return time_system::get_date(time_);
}
BOOST_CXX14_CONSTEXPR
time_duration_type time_of_day() const
{
return time_system::get_time_of_day(time_);
@@ -103,99 +96,83 @@ namespace date_time {
}
//! check to see if date is not a value
BOOST_CXX14_CONSTEXPR
bool is_not_a_date_time() const
{
return time_.is_not_a_date_time();
}
//! check to see if date is one of the infinity values
BOOST_CXX14_CONSTEXPR
bool is_infinity() const
{
return (is_pos_infinity() || is_neg_infinity());
}
//! check to see if date is greater than all possible dates
BOOST_CXX14_CONSTEXPR
bool is_pos_infinity() const
{
return time_.is_pos_infinity();
}
//! check to see if date is greater than all possible dates
BOOST_CXX14_CONSTEXPR
bool is_neg_infinity() const
{
return time_.is_neg_infinity();
}
//! check to see if time is a special value
BOOST_CXX14_CONSTEXPR
bool is_special() const
{
return(is_not_a_date_time() || is_infinity());
}
//!Equality operator -- others generated by boost::equality_comparable
BOOST_CXX14_CONSTEXPR
bool operator==(const time_type& rhs) const
{
return time_system::is_equal(time_,rhs.time_);
}
//!Equality operator -- others generated by boost::less_than_comparable
BOOST_CXX14_CONSTEXPR
bool operator<(const time_type& rhs) const
{
return time_system::is_less(time_,rhs.time_);
}
//! difference between two times
BOOST_CXX14_CONSTEXPR
time_duration_type operator-(const time_type& rhs) const
{
return time_system::subtract_times(time_, rhs.time_);
}
//! add date durations
BOOST_CXX14_CONSTEXPR
time_type operator+(const date_duration_type& dd) const
{
return time_system::add_days(time_, dd);
}
BOOST_CXX14_CONSTEXPR
time_type operator+=(const date_duration_type& dd)
{
time_ = (time_system::get_time_rep(date() + dd, time_of_day()));
return time_type(time_);
}
//! subtract date durations
BOOST_CXX14_CONSTEXPR
time_type operator-(const date_duration_type& dd) const
{
return time_system::subtract_days(time_, dd);
}
BOOST_CXX14_CONSTEXPR
time_type operator-=(const date_duration_type& dd)
{
time_ = (time_system::get_time_rep(date() - dd, time_of_day()));
return time_type(time_);
}
//! add time durations
BOOST_CXX14_CONSTEXPR
time_type operator+(const time_duration_type& td) const
{
return time_type(time_system::add_time_duration(time_, td));
}
BOOST_CXX14_CONSTEXPR
time_type operator+=(const time_duration_type& td)
{
time_ = time_system::add_time_duration(time_,td);
time_ = (time_system::get_time_rep(date(), time_of_day() + td));
return time_type(time_);
}
//! subtract time durations
BOOST_CXX14_CONSTEXPR
time_type operator-(const time_duration_type& rhs) const
{
return time_system::subtract_time_duration(time_, rhs);
}
BOOST_CXX14_CONSTEXPR
time_type operator-=(const time_duration_type& td)
{
time_ = time_system::subtract_time_duration(time_, td);
time_ = (time_system::get_time_rep(date(), time_of_day() - td));
return time_type(time_);
}
+54 -82
View File
@@ -2,21 +2,18 @@
#define DATE_TIME_TIME_DURATION_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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$
*/
#include <boost/core/enable_if.hpp>
#include <boost/cstdint.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/time_defs.hpp>
#include <boost/operators.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/date_time/time_defs.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/compiler_config.hpp>
namespace boost {
namespace date_time {
@@ -29,11 +26,11 @@ namespace date_time {
This design allows the subclass duration types to provide custom
construction policies or other custom features not provided here.
@tparam T The subclass type
@tparam rep_type The time resolution traits for this duration type.
@param T The subclass type
@param rep_type The time resolution traits for this duration type.
*/
template<class T, typename rep_type>
class BOOST_SYMBOL_VISIBLE time_duration : private
class time_duration : private
boost::less_than_comparable<T
, boost::equality_comparable<T
> >
@@ -44,8 +41,6 @@ namespace date_time {
* either (haven't tried) */
{
public:
// A tag for type categorization. Can be used to detect Boost.DateTime duration types in generic code.
typedef void _is_boost_date_time_duration;
typedef T duration_type; //the subclass
typedef rep_type traits_type;
typedef typename rep_type::day_type day_type;
@@ -56,53 +51,58 @@ namespace date_time {
typedef typename rep_type::tick_type tick_type;
typedef typename rep_type::impl_type impl_type;
BOOST_CXX14_CONSTEXPR time_duration() : ticks_(0) {}
BOOST_CXX14_CONSTEXPR time_duration(hour_type hours_in,
time_duration() : ticks_(0) {}
time_duration(hour_type hours_in,
min_type minutes_in,
sec_type seconds_in=0,
fractional_seconds_type frac_sec_in = 0) :
ticks_(rep_type::to_tick_count(hours_in,minutes_in,seconds_in,frac_sec_in))
{}
// copy constructor required for dividable<>
//! Construct from another time_duration (Copy constructor)
time_duration(const time_duration<T, rep_type>& other)
: ticks_(other.ticks_)
{}
//! Construct from special_values
BOOST_CXX14_CONSTEXPR time_duration(special_values sv) : ticks_(impl_type::from_special(sv))
time_duration(special_values sv) : ticks_(impl_type::from_special(sv))
{}
//! Returns smallest representable duration
static BOOST_CXX14_CONSTEXPR duration_type unit()
static duration_type unit()
{
return duration_type(0,0,0,1);
}
//! Return the number of ticks in a second
static BOOST_CXX14_CONSTEXPR tick_type ticks_per_second()
static tick_type ticks_per_second()
{
return rep_type::res_adjust();
}
//! Provide the resolution of this duration type
static BOOST_CXX14_CONSTEXPR time_resolutions resolution()
static time_resolutions resolution()
{
return rep_type::resolution();
}
//! Returns number of hours in the duration
BOOST_CXX14_CONSTEXPR hour_type hours() const
hour_type hours() const
{
return static_cast<hour_type>(ticks() / (3600*ticks_per_second()));
}
//! Returns normalized number of minutes
BOOST_CXX14_CONSTEXPR min_type minutes() const
min_type minutes() const
{
return static_cast<min_type>((ticks() / (60*ticks_per_second())) % 60);
}
//! Returns normalized number of seconds (0..60)
BOOST_CXX14_CONSTEXPR sec_type seconds() const
sec_type seconds() const
{
return static_cast<sec_type>((ticks()/ticks_per_second()) % 60);
}
//! Returns total number of seconds truncating any fractional seconds
BOOST_CXX14_CONSTEXPR sec_type total_seconds() const
sec_type total_seconds() const
{
return static_cast<sec_type>(ticks() / ticks_per_second());
}
//! Returns total number of milliseconds truncating any fractional seconds
BOOST_CXX14_CONSTEXPR tick_type total_milliseconds() const
tick_type total_milliseconds() const
{
if (ticks_per_second() < 1000) {
return ticks() * (static_cast<tick_type>(1000) / ticks_per_second());
@@ -110,7 +110,7 @@ namespace date_time {
return ticks() / (ticks_per_second() / static_cast<tick_type>(1000)) ;
}
//! Returns total number of nanoseconds truncating any sub millisecond values
BOOST_CXX14_CONSTEXPR tick_type total_nanoseconds() const
tick_type total_nanoseconds() const
{
if (ticks_per_second() < 1000000000) {
return ticks() * (static_cast<tick_type>(1000000000) / ticks_per_second());
@@ -118,7 +118,7 @@ namespace date_time {
return ticks() / (ticks_per_second() / static_cast<tick_type>(1000000000)) ;
}
//! Returns total number of microseconds truncating any sub microsecond values
BOOST_CXX14_CONSTEXPR tick_type total_microseconds() const
tick_type total_microseconds() const
{
if (ticks_per_second() < 1000000) {
return ticks() * (static_cast<tick_type>(1000000) / ticks_per_second());
@@ -126,97 +126,81 @@ namespace date_time {
return ticks() / (ticks_per_second() / static_cast<tick_type>(1000000)) ;
}
//! Returns count of fractional seconds at given resolution
BOOST_CXX14_CONSTEXPR fractional_seconds_type fractional_seconds() const
fractional_seconds_type fractional_seconds() const
{
return (ticks() % ticks_per_second());
}
//! Returns number of possible digits in fractional seconds
static BOOST_CXX14_CONSTEXPR unsigned short num_fractional_digits()
static unsigned short num_fractional_digits()
{
return rep_type::num_fractional_digits();
}
BOOST_CXX14_CONSTEXPR duration_type invert_sign() const
duration_type invert_sign() const
{
return duration_type(ticks_ * (-1));
}
BOOST_CXX14_CONSTEXPR duration_type abs() const
{
if ( is_negative() )
{
return invert_sign();
}
return duration_type(ticks_);
}
BOOST_CONSTEXPR bool is_negative() const
bool is_negative() const
{
return ticks_ < 0;
}
BOOST_CONSTEXPR bool is_zero() const
{
return ticks_ == 0;
}
BOOST_CONSTEXPR bool is_positive() const
{
return ticks_ > 0;
}
BOOST_CONSTEXPR bool operator<(const time_duration& rhs) const
bool operator<(const time_duration& rhs) const
{
return ticks_ < rhs.ticks_;
}
BOOST_CONSTEXPR bool operator==(const time_duration& rhs) const
bool operator==(const time_duration& rhs) const
{
return ticks_ == rhs.ticks_;
}
//! unary- Allows for time_duration td = -td1
BOOST_CONSTEXPR duration_type operator-()const
duration_type operator-()const
{
return duration_type(ticks_ * (-1));
}
BOOST_CONSTEXPR duration_type operator-(const duration_type& d) const
duration_type operator-(const duration_type& d) const
{
return duration_type(ticks_ - d.ticks_);
}
BOOST_CONSTEXPR duration_type operator+(const duration_type& d) const
duration_type operator+(const duration_type& d) const
{
return duration_type(ticks_ + d.ticks_);
}
BOOST_CONSTEXPR duration_type operator/(int divisor) const
duration_type operator/(int divisor) const
{
return duration_type(ticks_ / divisor);
}
BOOST_CXX14_CONSTEXPR duration_type operator-=(const duration_type& d)
duration_type operator-=(const duration_type& d)
{
ticks_ = ticks_ - d.ticks_;
return duration_type(ticks_);
}
BOOST_CXX14_CONSTEXPR duration_type operator+=(const duration_type& d)
duration_type operator+=(const duration_type& d)
{
ticks_ = ticks_ + d.ticks_;
return duration_type(ticks_);
}
//! Division operations on a duration with an integer.
BOOST_CXX14_CONSTEXPR duration_type operator/=(int divisor)
duration_type operator/=(int divisor)
{
ticks_ = ticks_ / divisor;
return duration_type(ticks_);
}
//! Multiplication operations an a duration with an integer
BOOST_CXX14_CONSTEXPR duration_type operator*(int rhs) const
duration_type operator*(int rhs) const
{
return duration_type(ticks_ * rhs);
}
BOOST_CXX14_CONSTEXPR duration_type operator*=(int divisor)
duration_type operator*=(int divisor)
{
ticks_ = ticks_ * divisor;
return duration_type(ticks_);
}
BOOST_CXX14_CONSTEXPR tick_type ticks() const
tick_type ticks() const
{
return traits_type::as_number(ticks_);
}
//! Is ticks_ a special value?
BOOST_CXX14_CONSTEXPR bool is_special()const
bool is_special()const
{
if(traits_type::is_adapted())
{
@@ -227,7 +211,7 @@ namespace date_time {
}
}
//! Is duration pos-infinity
BOOST_CXX14_CONSTEXPR bool is_pos_infinity()const
bool is_pos_infinity()const
{
if(traits_type::is_adapted())
{
@@ -238,7 +222,7 @@ namespace date_time {
}
}
//! Is duration neg-infinity
BOOST_CXX14_CONSTEXPR bool is_neg_infinity()const
bool is_neg_infinity()const
{
if(traits_type::is_adapted())
{
@@ -249,7 +233,7 @@ namespace date_time {
}
}
//! Is duration not-a-date-time
BOOST_CXX14_CONSTEXPR bool is_not_a_date_time()const
bool is_not_a_date_time()const
{
if(traits_type::is_adapted())
{
@@ -261,13 +245,13 @@ namespace date_time {
}
//! Used for special_values output
BOOST_CONSTEXPR impl_type get_rep()const
impl_type get_rep()const
{
return ticks_;
}
protected:
BOOST_CXX14_CONSTEXPR explicit time_duration(impl_type in) : ticks_(in) {}
explicit time_duration(impl_type in) : ticks_(in) {};
impl_type ticks_;
};
@@ -275,32 +259,20 @@ namespace date_time {
//! Template for instantiating derived adjusting durations
/* These templates are designed to work with multiples of
* 10 for frac_of_second and resolution adjustment
* 10 for frac_of_second and resoultion adjustment
*/
template<class base_duration, boost::int64_t frac_of_second>
class BOOST_SYMBOL_VISIBLE subsecond_duration : public base_duration
class subsecond_duration : public base_duration
{
public:
typedef typename base_duration::impl_type impl_type;
typedef typename base_duration::traits_type traits_type;
private:
// To avoid integer overflow we precompute the duration resolution conversion coefficient (ticket #3471)
BOOST_STATIC_ASSERT_MSG((traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second % frac_of_second : frac_of_second % traits_type::ticks_per_second) == 0,\
"The base duration resolution must be a multiple of the subsecond duration resolution");
BOOST_STATIC_CONSTANT(boost::int64_t, adjustment_ratio = (traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second / frac_of_second : frac_of_second / traits_type::ticks_per_second));
public:
// The argument (ss) must be an integral type
template <typename T>
BOOST_CXX14_CONSTEXPR explicit subsecond_duration(T const& ss,
typename boost::enable_if<boost::is_integral<T>,
void>::type* = BOOST_DATE_TIME_NULLPTR) :
base_duration(impl_type(traits_type::ticks_per_second >= frac_of_second ? ss * adjustment_ratio : ss / adjustment_ratio))
{
}
explicit subsecond_duration(boost::int64_t ss) :
base_duration(0,0,0,ss*traits_type::res_adjust()/frac_of_second)
{}
};
} } //namespace date_time
+121 -124
View File
@@ -11,13 +11,13 @@
*/
#include <cctype>
#include <exception>
#include <iomanip>
#include <iterator> // i/ostreambuf_iterator
#include <locale>
#include <limits>
#include <sstream>
#include <string>
#include <sstream>
#include <iomanip>
#include <iterator> // i/ostreambuf_iterator
#include <exception>
#include <boost/assert.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/throw_exception.hpp>
@@ -200,7 +200,7 @@ namespace date_time {
template <class time_type,
class CharT,
class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > >
class BOOST_SYMBOL_VISIBLE time_facet :
class time_facet :
public boost::date_time::date_facet<typename time_type::date_type , CharT, OutItrT> {
typedef time_formats< CharT > formats_type;
public:
@@ -244,22 +244,22 @@ namespace date_time {
#endif
//! sets default formats for ptime, local_date_time, and time_duration
explicit time_facet(::size_t ref_arg = 0)
: base_type(default_time_format, period_formatter_type(), special_values_formatter_type(), date_gen_formatter_type(), ref_arg),
explicit time_facet(::size_t a_ref = 0)
: base_type(default_time_format, period_formatter_type(), special_values_formatter_type(), date_gen_formatter_type(), a_ref),
m_time_duration_format(string_type(duration_sign_negative_only) + default_time_duration_format)
{}
//! Construct the facet with an explicitly specified format
explicit time_facet(const char_type* format_arg,
period_formatter_type period_formatter_arg = period_formatter_type(),
explicit time_facet(const char_type* a_format,
period_formatter_type period_formatter = period_formatter_type(),
const special_values_formatter_type& special_value_formatter = special_values_formatter_type(),
date_gen_formatter_type dg_formatter = date_gen_formatter_type(),
::size_t ref_arg = 0)
: base_type(format_arg,
period_formatter_arg,
::size_t a_ref = 0)
: base_type(a_format,
period_formatter,
special_value_formatter,
dg_formatter,
ref_arg),
a_ref),
m_time_duration_format(string_type(duration_sign_negative_only) + default_time_duration_format)
{}
@@ -269,65 +269,65 @@ namespace date_time {
m_time_duration_format = format;
}
void set_iso_format() BOOST_OVERRIDE
virtual void set_iso_format()
{
this->m_format = iso_time_format_specifier;
}
void set_iso_extended_format() BOOST_OVERRIDE
virtual void set_iso_extended_format()
{
this->m_format = iso_time_format_extended_specifier;
}
OutItrT put(OutItrT next_arg,
std::ios_base& ios_arg,
char_type fill_arg,
const time_type& time_arg) const
OutItrT put(OutItrT a_next,
std::ios_base& a_ios,
char_type a_fill,
const time_type& a_time) const
{
if (time_arg.is_special()) {
return this->do_put_special(next_arg, ios_arg, fill_arg,
time_arg.date().as_special());
if (a_time.is_special()) {
return this->do_put_special(a_next, a_ios, a_fill,
a_time.date().as_special());
}
string_type local_format(this->m_format);
string_type format(this->m_format);
// %T and %R have to be replaced here since they are not standard
boost::algorithm::replace_all(local_format,
boost::algorithm::replace_all(format,
boost::as_literal(formats_type::full_24_hour_time_format),
boost::as_literal(formats_type::full_24_hour_time_expanded_format));
boost::algorithm::replace_all(local_format,
boost::algorithm::replace_all(format,
boost::as_literal(formats_type::short_24_hour_time_format),
boost::as_literal(formats_type::short_24_hour_time_expanded_format));
string_type frac_str;
if (local_format.find(seconds_with_fractional_seconds_format) != string_type::npos) {
if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) {
// replace %s with %S.nnn
frac_str =
fractional_seconds_as_string(time_arg.time_of_day(), false);
char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point();
fractional_seconds_as_string(a_time.time_of_day(), false);
char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point();
string_type replace_string(seconds_format);
replace_string += sep;
replace_string += frac_str;
boost::algorithm::replace_all(local_format,
boost::algorithm::replace_all(format,
seconds_with_fractional_seconds_format,
replace_string);
}
/* NOTE: replacing posix_zone_string_format must be done BEFORE
* zone_name_format: "%ZP" & "%Z", if Z is checked first it will
* incorrectly replace a zone_name where a posix_string should go */
if (local_format.find(posix_zone_string_format) != string_type::npos) {
if(time_arg.zone_abbrev().empty()) {
if (format.find(posix_zone_string_format) != string_type::npos) {
if(a_time.zone_abbrev().empty()) {
// if zone_abbrev() returns an empty string, we want to
// erase posix_zone_string_format from format
boost::algorithm::erase_all(local_format, posix_zone_string_format);
boost::algorithm::erase_all(format, posix_zone_string_format);
}
else{
boost::algorithm::replace_all(local_format,
boost::algorithm::replace_all(format,
posix_zone_string_format,
time_arg.zone_as_posix_string());
a_time.zone_as_posix_string());
}
}
if (local_format.find(zone_name_format) != string_type::npos) {
if(time_arg.zone_name().empty()) {
if (format.find(zone_name_format) != string_type::npos) {
if(a_time.zone_name().empty()) {
/* TODO: this'll probably create problems if a user places
* the zone_*_format flag in the format with a ptime. This
* code removes the flag from the default formats */
@@ -336,16 +336,16 @@ namespace date_time {
// erase zone_name_format & one preceeding space
std::basic_ostringstream<char_type> ss;
ss << ' ' << zone_name_format;
boost::algorithm::erase_all(local_format, ss.str());
boost::algorithm::erase_all(format, ss.str());
}
else{
boost::algorithm::replace_all(local_format,
boost::algorithm::replace_all(format,
zone_name_format,
time_arg.zone_name());
a_time.zone_name());
}
}
if (local_format.find(zone_abbrev_format) != string_type::npos) {
if(time_arg.zone_abbrev(false).empty()) {
if (format.find(zone_abbrev_format) != string_type::npos) {
if(a_time.zone_abbrev(false).empty()) {
/* TODO: this'll probably create problems if a user places
* the zone_*_format flag in the format with a ptime. This
* code removes the flag from the default formats */
@@ -354,93 +354,93 @@ namespace date_time {
// erase zone_abbrev_format & one preceeding space
std::basic_ostringstream<char_type> ss;
ss << ' ' << zone_abbrev_format;
boost::algorithm::erase_all(local_format, ss.str());
boost::algorithm::erase_all(format, ss.str());
}
else{
boost::algorithm::replace_all(local_format,
boost::algorithm::replace_all(format,
zone_abbrev_format,
time_arg.zone_abbrev(false));
a_time.zone_abbrev(false));
}
}
if (local_format.find(zone_iso_extended_format) != string_type::npos) {
if(time_arg.zone_name(true).empty()) {
if (format.find(zone_iso_extended_format) != string_type::npos) {
if(a_time.zone_name(true).empty()) {
/* TODO: this'll probably create problems if a user places
* the zone_*_format flag in the format with a ptime. This
* code removes the flag from the default formats */
// if zone_name() returns an empty string, we want to
// erase zone_iso_extended_format from format
boost::algorithm::erase_all(local_format, zone_iso_extended_format);
boost::algorithm::erase_all(format, zone_iso_extended_format);
}
else{
boost::algorithm::replace_all(local_format,
boost::algorithm::replace_all(format,
zone_iso_extended_format,
time_arg.zone_name(true));
a_time.zone_name(true));
}
}
if (local_format.find(zone_iso_format) != string_type::npos) {
if(time_arg.zone_abbrev(true).empty()) {
if (format.find(zone_iso_format) != string_type::npos) {
if(a_time.zone_abbrev(true).empty()) {
/* TODO: this'll probably create problems if a user places
* the zone_*_format flag in the format with a ptime. This
* code removes the flag from the default formats */
// if zone_abbrev() returns an empty string, we want to
// erase zone_iso_format from format
boost::algorithm::erase_all(local_format, zone_iso_format);
boost::algorithm::erase_all(format, zone_iso_format);
}
else{
boost::algorithm::replace_all(local_format,
boost::algorithm::replace_all(format,
zone_iso_format,
time_arg.zone_abbrev(true));
a_time.zone_abbrev(true));
}
}
if (local_format.find(fractional_seconds_format) != string_type::npos) {
if (format.find(fractional_seconds_format) != string_type::npos) {
// replace %f with nnnnnnn
if (frac_str.empty()) {
frac_str = fractional_seconds_as_string(time_arg.time_of_day(), false);
frac_str = fractional_seconds_as_string(a_time.time_of_day(), false);
}
boost::algorithm::replace_all(local_format,
boost::algorithm::replace_all(format,
fractional_seconds_format,
frac_str);
}
if (local_format.find(fractional_seconds_or_none_format) != string_type::npos) {
if (format.find(fractional_seconds_or_none_format) != string_type::npos) {
// replace %F with nnnnnnn or nothing if fs == 0
frac_str =
fractional_seconds_as_string(time_arg.time_of_day(), true);
if (!frac_str.empty()) {
char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point();
fractional_seconds_as_string(a_time.time_of_day(), true);
if (frac_str.size()) {
char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point();
string_type replace_string;
replace_string += sep;
replace_string += frac_str;
boost::algorithm::replace_all(local_format,
boost::algorithm::replace_all(format,
fractional_seconds_or_none_format,
replace_string);
}
else {
boost::algorithm::erase_all(local_format,
boost::algorithm::erase_all(format,
fractional_seconds_or_none_format);
}
}
return this->do_put_tm(next_arg, ios_arg, fill_arg,
to_tm(time_arg), local_format);
return this->do_put_tm(a_next, a_ios, a_fill,
to_tm(a_time), format);
}
//! put function for time_duration
OutItrT put(OutItrT next_arg,
std::ios_base& ios_arg,
char_type fill_arg,
const time_duration_type& time_dur_arg) const
OutItrT put(OutItrT a_next,
std::ios_base& a_ios,
char_type a_fill,
const time_duration_type& a_time_dur) const
{
if (time_dur_arg.is_special()) {
return this->do_put_special(next_arg, ios_arg, fill_arg,
time_dur_arg.get_rep().as_special());
if (a_time_dur.is_special()) {
return this->do_put_special(a_next, a_ios, a_fill,
a_time_dur.get_rep().as_special());
}
string_type format(m_time_duration_format);
if (time_dur_arg.is_negative()) {
if (a_time_dur.is_negative()) {
// replace %- with minus sign. Should we use the numpunct facet?
boost::algorithm::replace_all(format,
duration_sign_negative_only,
@@ -477,15 +477,15 @@ namespace date_time {
*/
string_type hours_str;
if (format.find(unrestricted_hours_format) != string_type::npos) {
hours_str = hours_as_string(time_dur_arg);
hours_str = hours_as_string(a_time_dur);
boost::algorithm::replace_all(format, unrestricted_hours_format, hours_str);
}
// We still have to process restricted hours format specifier. In order to
// support parseability of durations in ISO 8601 format (%H%M%S), we'll have to
// support parseability of durations in ISO format (%H%M%S), we'll have to
// restrict the stringified hours length to 2 characters.
if (format.find(hours_format) != string_type::npos) {
if (hours_str.empty())
hours_str = hours_as_string(time_dur_arg);
hours_str = hours_as_string(a_time_dur);
BOOST_ASSERT(hours_str.length() <= 2);
boost::algorithm::replace_all(format, hours_format, hours_str);
}
@@ -494,8 +494,8 @@ namespace date_time {
if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) {
// replace %s with %S.nnn
frac_str =
fractional_seconds_as_string(time_dur_arg, false);
char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point();
fractional_seconds_as_string(a_time_dur, false);
char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point();
string_type replace_string(seconds_format);
replace_string += sep;
@@ -507,7 +507,7 @@ namespace date_time {
if (format.find(fractional_seconds_format) != string_type::npos) {
// replace %f with nnnnnnn
if (!frac_str.size()) {
frac_str = fractional_seconds_as_string(time_dur_arg, false);
frac_str = fractional_seconds_as_string(a_time_dur, false);
}
boost::algorithm::replace_all(format,
fractional_seconds_format,
@@ -517,9 +517,9 @@ namespace date_time {
if (format.find(fractional_seconds_or_none_format) != string_type::npos) {
// replace %F with nnnnnnn or nothing if fs == 0
frac_str =
fractional_seconds_as_string(time_dur_arg, true);
fractional_seconds_as_string(a_time_dur, true);
if (frac_str.size()) {
char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point();
char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point();
string_type replace_string;
replace_string += sep;
replace_string += frac_str;
@@ -533,14 +533,14 @@ namespace date_time {
}
}
return this->do_put_tm(next_arg, ios_arg, fill_arg,
to_tm(time_dur_arg), format);
return this->do_put_tm(a_next, a_ios, a_fill,
to_tm(a_time_dur), format);
}
OutItrT put(OutItrT next, std::ios_base& ios_arg,
OutItrT put(OutItrT next, std::ios_base& a_ios,
char_type fill, const period_type& p) const
{
return this->m_period_formatter.put_period(next, ios_arg, fill,p,*this);
return this->m_period_formatter.put_period(next, a_ios, fill,p,*this);
}
@@ -548,11 +548,11 @@ namespace date_time {
static
string_type
fractional_seconds_as_string(const time_duration_type& time_arg,
fractional_seconds_as_string(const time_duration_type& a_time,
bool null_when_zero)
{
typename time_duration_type::fractional_seconds_type frac_sec =
time_arg.fractional_seconds();
a_time.fractional_seconds();
if (null_when_zero && (frac_sec == 0)) {
return string_type();
@@ -566,9 +566,9 @@ namespace date_time {
static
string_type
hours_as_string(const time_duration_type& time_arg, int width = 2)
hours_as_string(const time_duration_type& a_time, int width = 2)
{
return integral_as_string(date_time::absolute_value(time_arg.hours()), width);
return integral_as_string(date_time::absolute_value(a_time.hours()), width);
}
template< typename IntT >
@@ -693,7 +693,7 @@ namespace date_time {
template <class time_type,
class CharT,
class InItrT = std::istreambuf_iterator<CharT, std::char_traits<CharT> > >
class BOOST_SYMBOL_VISIBLE time_input_facet :
class time_input_facet :
public boost::date_time::date_input_facet<typename time_type::date_type , CharT, InItrT> {
public:
typedef typename time_type::date_type date_type;
@@ -731,8 +731,8 @@ namespace date_time {
static std::locale::id id;
//! Constructor that takes a format string for a ptime
explicit time_input_facet(const string_type& format, ::size_t ref_arg = 0)
: base_type(format, ref_arg),
explicit time_input_facet(const string_type& format, ::size_t a_ref = 0)
: base_type(format, a_ref),
m_time_duration_format(default_time_duration_format)
{ }
@@ -741,19 +741,19 @@ namespace date_time {
const special_values_parser_type& sv_parser,
const period_parser_type& per_parser,
const date_gen_parser_type& date_gen_parser,
::size_t ref_arg = 0)
::size_t a_ref = 0)
: base_type(format,
date_parser,
sv_parser,
per_parser,
date_gen_parser,
ref_arg),
a_ref),
m_time_duration_format(default_time_duration_format)
{}
//! sets default formats for ptime, local_date_time, and time_duration
explicit time_input_facet(::size_t ref_arg = 0)
: base_type(default_time_input_format, ref_arg),
explicit time_input_facet(::size_t a_ref = 0)
: base_type(default_time_input_format, a_ref),
m_time_duration_format(default_time_duration_format)
{ }
@@ -772,12 +772,12 @@ namespace date_time {
InItrT get(InItrT& sitr,
InItrT& stream_end,
std::ios_base& ios_arg,
std::ios_base& a_ios,
period_type& p) const
{
p = this->m_period_parser.get_period(sitr,
stream_end,
ios_arg,
a_ios,
p,
time_duration_type::unit(),
*this);
@@ -789,7 +789,7 @@ namespace date_time {
InItrT get(InItrT& sitr,
InItrT& stream_end,
std::ios_base& ios_arg,
std::ios_base& a_ios,
time_duration_type& td) const
{
// skip leading whitespace
@@ -813,16 +813,16 @@ namespace date_time {
typename time_duration_type::fractional_seconds_type frac(0);
typedef std::num_get<CharT, InItrT> num_get;
if(!std::has_facet<num_get>(ios_arg.getloc())) {
if(!std::has_facet<num_get>(a_ios.getloc())) {
num_get* ng = new num_get();
std::locale loc = std::locale(ios_arg.getloc(), ng);
ios_arg.imbue(loc);
std::locale loc = std::locale(a_ios.getloc(), ng);
a_ios.imbue(loc);
}
const_itr itr(m_time_duration_format.begin());
while (itr != m_time_duration_format.end() && (sitr != stream_end)) {
if (*itr == '%') {
if (++itr == m_time_duration_format.end()) break;
++itr;
if (*itr != '%') {
switch(*itr) {
case 'O':
@@ -866,7 +866,6 @@ namespace date_time {
break;
// %s is the same as %S%f so we drop through into %f
}
/* Falls through. */
case 'f':
{
// check for decimal, check special_values if missing
@@ -929,27 +928,27 @@ namespace date_time {
//! Parses a time object from the input stream
InItrT get(InItrT& sitr,
InItrT& stream_end,
std::ios_base& ios_arg,
std::ios_base& a_ios,
time_type& t) const
{
string_type tz_str;
return get(sitr, stream_end, ios_arg, t, tz_str, false);
return get(sitr, stream_end, a_ios, t, tz_str, false);
}
//! Expects a time_zone in the input stream
InItrT get_local_time(InItrT& sitr,
InItrT& stream_end,
std::ios_base& ios_arg,
std::ios_base& a_ios,
time_type& t,
string_type& tz_str) const
{
return get(sitr, stream_end, ios_arg, t, tz_str, true);
return get(sitr, stream_end, a_ios, t, tz_str, true);
}
protected:
InItrT get(InItrT& sitr,
InItrT& stream_end,
std::ios_base& ios_arg,
std::ios_base& a_ios,
time_type& t,
string_type& tz_str,
bool time_is_local) const
@@ -958,7 +957,7 @@ namespace date_time {
while((sitr != stream_end) && std::isspace(*sitr)) { ++sitr; }
bool use_current_char = false;
bool use_current_format_char = false; // used with two character flags
bool use_current_format_char = false; // used whith two character flags
// num_get will consume the +/-, we may need a copy if special_value
char_type c = '\0';
@@ -986,16 +985,16 @@ namespace date_time {
day_type t_day(1);
typedef std::num_get<CharT, InItrT> num_get;
if(!std::has_facet<num_get>(ios_arg.getloc())) {
if(!std::has_facet<num_get>(a_ios.getloc())) {
num_get* ng = new num_get();
std::locale loc = std::locale(ios_arg.getloc(), ng);
ios_arg.imbue(loc);
std::locale loc = std::locale(a_ios.getloc(), ng);
a_ios.imbue(loc);
}
const_itr itr(this->m_format.begin());
while (itr != this->m_format.end() && (sitr != stream_end)) {
if (*itr == '%') {
if (++itr == this->m_format.end()) break;
++itr;
if (*itr != '%') {
// the cases are grouped by date & time flags - not alphabetical order
switch(*itr) {
@@ -1089,12 +1088,9 @@ namespace date_time {
break;
}
case 'd':
case 'e':
{
try {
t_day = (*itr == 'd') ?
this->m_parser.parse_day_of_month(sitr, stream_end) :
this->m_parser.parse_var_day_of_month(sitr, stream_end);
t_day = this->m_parser.parse_day_of_month(sitr, stream_end);
}
catch(std::out_of_range&) { // base class for exception bad_day_of_month
match_results mr;
@@ -1135,12 +1131,10 @@ namespace date_time {
if(sec == -1){
return check_special_value(sitr, stream_end, t, c);
}
if (*itr == 'S' || sitr == stream_end)
if (*itr == 'S')
break;
// %s is the same as %S%f so we drop through into %f if we are
// not at the end of the stream
// %s is the same as %S%f so we drop through into %f
}
/* Falls through. */
case 'f':
{
// check for decimal, check SV if missing
@@ -1232,7 +1226,7 @@ namespace date_time {
date_type d(not_a_date_time);
if (day_of_year > 0) {
d = date_type(static_cast<unsigned short>(t_year),1,1) + date_duration_type(day_of_year-1);
d = date_type(static_cast<unsigned short>(t_year-1),12,31) + date_duration_type(day_of_year);
}
else {
d = date_type(t_year, t_month, t_day);
@@ -1255,7 +1249,7 @@ namespace date_time {
if((c == '-' || c == '+') && (*sitr != c)) { // was the first character consumed?
mr.cache += c;
}
(void)this->m_sv_parser.match(sitr, stream_end, mr);
this->m_sv_parser.match(sitr, stream_end, mr);
if(mr.current_match == match_results::PARSE_ERROR) {
std::string tmp = convert_string_type<char_type, char>(mr.cache);
boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + tmp + "'"));
@@ -1365,6 +1359,9 @@ template <class time_type, class CharT, class InItrT>
const typename time_input_facet<time_type, CharT, InItrT>::char_type*
time_input_facet<time_type, CharT, InItrT>::default_time_duration_format = time_formats<CharT>::default_time_duration_format;
} } // namespaces
#endif
+16 -16
View File
@@ -2,7 +2,7 @@
#define DATE_TIME_TIME_ITERATOR_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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
@@ -12,40 +12,40 @@
namespace boost {
namespace date_time {
//! Simple time iterator skeleton class
template<class time_type>
class time_itr {
public:
typedef typename time_type::time_duration_type time_duration_type;
time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {}
time_itr& operator++()
time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {};
time_itr& operator++()
{
current_ = current_ + offset_;
return *this;
}
time_itr& operator--()
time_itr& operator--()
{
current_ = current_ - offset_;
return *this;
}
const time_type& operator*() const {return current_;}
const time_type* operator->() const {return &current_;}
bool operator< (const time_type& t) const {return current_ < t;}
bool operator<= (const time_type& t) const {return current_ <= t;}
bool operator!= (const time_type& t) const {return current_ != t;}
bool operator== (const time_type& t) const {return current_ == t;}
bool operator> (const time_type& t) const {return current_ > t;}
bool operator>= (const time_type& t) const {return current_ >= t;}
time_type operator*() {return current_;};
time_type* operator->() {return &current_;};
bool operator< (const time_type& t) {return current_ < t;};
bool operator<= (const time_type& t) {return current_ <= t;};
bool operator!= (const time_type& t) {return current_ != t;};
bool operator== (const time_type& t) {return current_ == t;};
bool operator> (const time_type& t) {return current_ > t;};
bool operator>= (const time_type& t) {return current_ >= t;};
private:
time_type current_;
time_duration_type offset_;
};
} }//namespace date_time
+11 -29
View File
@@ -12,7 +12,6 @@
#include "boost/tokenizer.hpp"
#include "boost/lexical_cast.hpp"
#include "boost/date_time/date_parsing.hpp"
#include "boost/date_time/special_values_parser.hpp"
#include "boost/cstdint.hpp"
#include <iostream>
@@ -21,7 +20,7 @@ namespace date_time {
//! computes exponential math like 2^8 => 256, only works with positive integers
//Not general purpose, but needed b/c std::pow is not available
//everywhere. Hasn't been tested with negatives and zeros
//everywehere. Hasn't been tested with negatives and zeros
template<class int_type>
inline
int_type power(int_type base, int_type exponent)
@@ -79,7 +78,7 @@ namespace date_time {
case 2: {
sec = boost::lexical_cast<unsigned short>(*beg);
break;
}
};
case 3: {
int digits = static_cast<int>(beg->length());
//Works around a bug in MSVC 6 library that does not support
@@ -117,7 +116,6 @@ namespace date_time {
break;
}
default: break;
}//switch
pos++;
}
@@ -155,10 +153,9 @@ namespace date_time {
std::string& first,
std::string& second)
{
std::string::size_type sep_pos = s.find(sep);
int sep_pos = static_cast<int>(s.find(sep));
first = s.substr(0,sep_pos);
if (sep_pos!=std::string::npos)
second = s.substr(sep_pos+1);
second = s.substr(sep_pos+1);
return true;
}
@@ -183,7 +180,7 @@ namespace date_time {
}
//! Parse time duration part of an ISO 8601 time of form: [-]hhmmss[.fff...] (eg: 120259.123 is 12 hours, 2 min, 59 seconds, 123000 microseconds)
//! Parse time duration part of an iso time of form: [-]hhmmss[.fff...] (eg: 120259.123 is 12 hours, 2 min, 59 seconds, 123000 microseconds)
template<class time_duration>
inline
time_duration
@@ -283,8 +280,7 @@ namespace date_time {
break;
}
default: break;
}
};
pos++;
}
if(sign) {
@@ -303,25 +299,6 @@ namespace date_time {
{
typedef typename time_type::time_duration_type time_duration;
typedef typename time_type::date_type date_type;
typedef special_values_parser<date_type, std::string::value_type> svp_type;
// given to_iso_string can produce a special value string
// then from_iso_string should be able to read a special value string
// the special_values_parser is expensive to set up and not thread-safe
// so it cannot be static, so we need to be careful about when we use it
if (svp_type::should_call_match(s)) {
typedef typename svp_type::stringstream_type ss_type;
typedef typename svp_type::stream_itr_type itr_type;
typedef typename svp_type::match_results mr_type;
svp_type p; // expensive
mr_type mr;
ss_type ss(s);
itr_type itr(ss);
itr_type end;
if (p.match(itr, end, mr)) {
return time_type(static_cast<special_values>(mr.current_match));
}
}
//split date/time on a unique delimiter char such as ' ' or 'T'
std::string date_string, tod_string;
@@ -334,6 +311,11 @@ namespace date_time {
return time_type(d, td);
}
} }//namespace date_time
#endif
@@ -9,7 +9,7 @@
* $Date$
*/
#include <ctime>
#include <boost/cstdint.hpp>
#include <boost/date_time/time_defs.hpp>
#include <boost/date_time/int_adapter.hpp>
@@ -22,7 +22,7 @@ namespace date_time {
template <typename T>
// JDG [7/6/02 made a template],
// moved here from time_duration.hpp 2003-Sept-4.
inline BOOST_CXX14_CONSTEXPR T absolute_value(T x)
inline T absolute_value(T x)
{
return x < 0 ? -x : x;
}
@@ -31,58 +31,35 @@ namespace date_time {
struct time_resolution_traits_bi32_impl {
typedef boost::int32_t int_type;
typedef boost::int32_t impl_type;
static BOOST_CXX14_CONSTEXPR int_type as_number(impl_type i){ return i;}
static int_type as_number(impl_type i){ return i;}
//! Used to determine if implemented type is int_adapter or int
static BOOST_CXX14_CONSTEXPR bool is_adapted() { return false;}
static bool is_adapted() { return false;}
};
//! traits struct for time_resolution_traits implementation type
struct time_resolution_traits_adapted32_impl {
typedef boost::int32_t int_type;
typedef boost::date_time::int_adapter<boost::int32_t> impl_type;
static BOOST_CXX14_CONSTEXPR int_type as_number(impl_type i){ return i.as_number();}
static int_type as_number(impl_type i){ return i.as_number();}
//! Used to determine if implemented type is int_adapter or int
static BOOST_CXX14_CONSTEXPR bool is_adapted() { return true;}
static bool is_adapted() { return true;}
};
//! traits struct for time_resolution_traits implementation type
struct time_resolution_traits_bi64_impl {
typedef boost::int64_t int_type;
typedef boost::int64_t impl_type;
static BOOST_CXX14_CONSTEXPR int_type as_number(impl_type i){ return i;}
static int_type as_number(impl_type i){ return i;}
//! Used to determine if implemented type is int_adapter or int
static BOOST_CXX14_CONSTEXPR bool is_adapted() { return false;}
static bool is_adapted() { return false;}
};
//! traits struct for time_resolution_traits implementation type
struct time_resolution_traits_adapted64_impl {
typedef boost::int64_t int_type;
typedef boost::date_time::int_adapter<boost::int64_t> impl_type;
static BOOST_CXX14_CONSTEXPR int_type as_number(impl_type i){ return i.as_number();}
static int_type as_number(impl_type i){ return i.as_number();}
//! Used to determine if implemented type is int_adapter or int
static BOOST_CXX14_CONSTEXPR bool is_adapted() { return true;}
static bool is_adapted() { return true;}
};
//
// Note about var_type, which is used to define the variable that
// stores hours, minutes, and seconds values:
//
// In Boost 1.65.1 and earlier var_type was boost::int32_t which suffers
// the year 2038 problem. Binary serialization of posix_time uses
// 32-bit values, and uses serialization version 0.
//
// In Boost 1.66.0 the var_type changed to std::time_t, however
// binary serialization was not properly versioned, so on platforms
// where std::time_t is 32-bits, it remains compatible, however on
// platforms where std::time_t is 64-bits, binary serialization ingest
// will be incompatible with previous versions. Furthermore, binary
// serialized output from 1.66.0 will not be compatible with future
// versions. Yes, it's a mess. Static assertions were not present
// in the serialization code to protect against this possibility.
//
// In Boost 1.67.0 the var_type was changed to boost::int64_t,
// ensuring the output size is 64 bits, and the serialization version
// was bumped. Static assertions were added as well, protecting
// future changes in this area.
//
template<typename frac_sec_type,
time_resolutions res,
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
@@ -91,23 +68,23 @@ namespace date_time {
typename frac_sec_type::int_type resolution_adjust,
#endif
unsigned short frac_digits,
typename var_type = boost::int64_t > // see note above
typename v_type = boost::int32_t >
class time_resolution_traits {
public:
typedef typename frac_sec_type::int_type fractional_seconds_type;
typedef typename frac_sec_type::int_type tick_type;
typedef typename frac_sec_type::impl_type impl_type;
typedef var_type day_type;
typedef var_type hour_type;
typedef var_type min_type;
typedef var_type sec_type;
typedef v_type day_type;
typedef v_type hour_type;
typedef v_type min_type;
typedef v_type sec_type;
// bring in function from frac_sec_type traits structs
static BOOST_CXX14_CONSTEXPR fractional_seconds_type as_number(impl_type i)
static fractional_seconds_type as_number(impl_type i)
{
return frac_sec_type::as_number(i);
}
static BOOST_CXX14_CONSTEXPR bool is_adapted()
static bool is_adapted()
{
return frac_sec_type::is_adapted();
}
@@ -119,23 +96,23 @@ namespace date_time {
BOOST_STATIC_CONSTANT(fractional_seconds_type, ticks_per_second = resolution_adjust);
#endif
static BOOST_CXX14_CONSTEXPR time_resolutions resolution()
static time_resolutions resolution()
{
return res;
}
static BOOST_CXX14_CONSTEXPR unsigned short num_fractional_digits()
static unsigned short num_fractional_digits()
{
return frac_digits;
}
static BOOST_CXX14_CONSTEXPR fractional_seconds_type res_adjust()
static fractional_seconds_type res_adjust()
{
return resolution_adjust;
}
//! Any negative argument results in a negative tick_count
static BOOST_CXX14_CONSTEXPR tick_type to_tick_count(hour_type hours,
min_type minutes,
sec_type seconds,
fractional_seconds_type fs)
static tick_type to_tick_count(hour_type hours,
min_type minutes,
sec_type seconds,
fractional_seconds_type fs)
{
if(hours < 0 || minutes < 0 || seconds < 0 || fs < 0)
{
@@ -143,14 +120,14 @@ namespace date_time {
minutes = absolute_value(minutes);
seconds = absolute_value(seconds);
fs = absolute_value(fs);
return static_cast<tick_type>(((((fractional_seconds_type(hours)*3600)
+ (fractional_seconds_type(minutes)*60)
+ seconds)*res_adjust()) + fs) * -1);
return (((((fractional_seconds_type(hours)*3600)
+ (fractional_seconds_type(minutes)*60)
+ seconds)*res_adjust()) + fs) * -1);
}
return static_cast<tick_type>((((fractional_seconds_type(hours)*3600)
+ (fractional_seconds_type(minutes)*60)
+ seconds)*res_adjust()) + fs);
return (((fractional_seconds_type(hours)*3600)
+ (fractional_seconds_type(minutes)*60)
+ seconds)*res_adjust()) + fs;
}
};
+51 -66
View File
@@ -2,7 +2,7 @@
#define DATE_TIME_TIME_SYSTEM_COUNTED_HPP
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* 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
@@ -10,9 +10,8 @@
*/
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/time_defs.hpp>
#include <boost/date_time/special_defs.hpp>
#include "boost/date_time/time_defs.hpp"
#include <string>
@@ -31,89 +30,84 @@ namespace date_time {
typedef typename date_type::ymd_type ymd_type;
typedef typename config::time_duration_type time_duration_type;
typedef typename config::resolution_traits resolution_traits;
BOOST_CXX14_CONSTEXPR
counted_time_rep(const date_type& d, const time_duration_type& time_of_day)
counted_time_rep(const date_type& d, const time_duration_type& time_of_day)
: time_count_(1)
{
if(d.is_infinity() || d.is_not_a_date() || time_of_day.is_special()) {
time_count_ = time_of_day.get_rep() + d.day_count();
//std::cout << time_count_ << std::endl;
}
else {
else {
time_count_ = (d.day_number() * frac_sec_per_day()) + time_of_day.ticks();
}
}
BOOST_CXX14_CONSTEXPR
explicit counted_time_rep(int_type count) :
time_count_(count)
{}
BOOST_CXX14_CONSTEXPR
explicit counted_time_rep(impl_type count) :
time_count_(count)
{}
BOOST_CXX14_CONSTEXPR
date_type date() const
{
if(time_count_.is_special()) {
return date_type(time_count_.as_special());
}
else {
typename calendar_type::date_int_type dc = static_cast<typename calendar_type::date_int_type>(day_count());
typename calendar_type::date_int_type dc = day_count();
//std::cout << "time_rep here:" << dc << std::endl;
ymd_type ymd = calendar_type::from_day_number(dc);
return date_type(ymd);
}
}
//int_type day_count() const
BOOST_CXX14_CONSTEXPR
unsigned long day_count() const
{
/* resolution_traits::as_number returns a boost::int64_t &
* frac_sec_per_day is also a boost::int64_t so, naturally,
* the division operation returns a boost::int64_t.
* The static_cast to an unsigned long is ok (results in no data loss)
* because frac_sec_per_day is either the number of
* microseconds per day, or the number of nanoseconds per day.
* Worst case scenario: resolution_traits::as_number returns the
* maximum value an int64_t can hold and frac_sec_per_day
* is microseconds per day (lowest possible value).
* The division operation will then return a value of 106751991 -
* easily fitting in an unsigned long.
/* resolution_traits::as_number returns a boost::int64_t &
* frac_sec_per_day is also a boost::int64_t so, naturally,
* the division operation returns a boost::int64_t.
* The static_cast to an unsigned long is ok (results in no data loss)
* because frac_sec_per_day is either the number of
* microseconds per day, or the number of nanoseconds per day.
* Worst case scenario: resolution_traits::as_number returns the
* maximum value an int64_t can hold and frac_sec_per_day
* is microseconds per day (lowest possible value).
* The division operation will then return a value of 106751991 -
* easily fitting in an unsigned long.
*/
return static_cast<unsigned long>(resolution_traits::as_number(time_count_) / frac_sec_per_day());
}
BOOST_CXX14_CONSTEXPR int_type time_count() const
int_type time_count() const
{
return resolution_traits::as_number(time_count_);
}
BOOST_CXX14_CONSTEXPR int_type tod() const
int_type tod() const
{
return resolution_traits::as_number(time_count_) % frac_sec_per_day();
}
static BOOST_CXX14_CONSTEXPR int_type frac_sec_per_day()
static int_type frac_sec_per_day()
{
int_type seconds_per_day = 60*60*24;
int_type fractional_sec_per_sec(resolution_traits::res_adjust());
return seconds_per_day*fractional_sec_per_sec;
}
BOOST_CXX14_CONSTEXPR bool is_pos_infinity()const
bool is_pos_infinity()const
{
return impl_type::is_pos_inf(time_count_.as_number());
}
BOOST_CXX14_CONSTEXPR bool is_neg_infinity()const
bool is_neg_infinity()const
{
return impl_type::is_neg_inf(time_count_.as_number());
}
BOOST_CXX14_CONSTEXPR bool is_not_a_date_time()const
bool is_not_a_date_time()const
{
return impl_type::is_not_a_number(time_count_.as_number());
}
BOOST_CXX14_CONSTEXPR bool is_special()const
bool is_special()const
{
return time_count_.is_special();
}
BOOST_CXX14_CONSTEXPR impl_type get_rep()const
impl_type get_rep()const
{
return time_count_;
}
@@ -134,28 +128,27 @@ namespace date_time {
typedef typename time_rep_type::date_duration_type date_duration_type;
template<class T> static BOOST_CXX14_CONSTEXPR void unused_var(const T&) {}
template<class T> static void unused_var(const T&) {}
static BOOST_CXX14_CONSTEXPR
time_rep_type get_time_rep(const date_type& day,
const time_duration_type& tod,
date_time::dst_flags dst=not_dst)
static time_rep_type get_time_rep(const date_type& day,
const time_duration_type& tod,
date_time::dst_flags dst=not_dst)
{
unused_var(dst);
return time_rep_type(day, tod);
}
static BOOST_CXX14_CONSTEXPR time_rep_type get_time_rep(special_values sv)
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),
return time_rep_type(date_type(pos_infin),
time_duration_type(pos_infin));
case neg_infin:
return time_rep_type(date_type(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);
@@ -167,42 +160,38 @@ namespace date_time {
default:
return time_rep_type(date_type(not_a_date_time),
time_duration_type(not_a_date_time));
}
}
static BOOST_CXX14_CONSTEXPR date_type
get_date(const time_rep_type& val)
static date_type get_date(const time_rep_type& val)
{
return val.date();
}
static BOOST_CXX14_CONSTEXPR
time_duration_type get_time_of_day(const time_rep_type& val)
static time_duration_type get_time_of_day(const time_rep_type& val)
{
if(val.is_special()) {
return time_duration_type(val.get_rep().as_special());
}
else{
return time_duration_type(0,0,0,val.tod());
return time_duration_type(0,0,0,val.tod());
}
}
static std::string zone_name(const time_rep_type&)
{
return "";
}
static BOOST_CXX14_CONSTEXPR bool is_equal(const time_rep_type& lhs, const time_rep_type& rhs)
static bool is_equal(const time_rep_type& lhs, const time_rep_type& rhs)
{
return (lhs.time_count() == rhs.time_count());
}
static BOOST_CXX14_CONSTEXPR
bool is_less(const time_rep_type& lhs, const time_rep_type& rhs)
static bool is_less(const time_rep_type& lhs, const time_rep_type& rhs)
{
return (lhs.time_count() < rhs.time_count());
}
static BOOST_CXX14_CONSTEXPR
time_rep_type add_days(const time_rep_type& base,
const date_duration_type& dd)
static time_rep_type add_days(const time_rep_type& base,
const date_duration_type& dd)
{
if(base.is_special() || dd.is_special()) {
return(time_rep_type(base.get_rep() + dd.get_rep()));
@@ -211,9 +200,8 @@ namespace date_time {
return time_rep_type(base.time_count() + (dd.days() * time_rep_type::frac_sec_per_day()));
}
}
static BOOST_CXX14_CONSTEXPR
time_rep_type subtract_days(const time_rep_type& base,
const date_duration_type& dd)
static time_rep_type subtract_days(const time_rep_type& base,
const date_duration_type& dd)
{
if(base.is_special() || dd.is_special()) {
return(time_rep_type(base.get_rep() - dd.get_rep()));
@@ -222,9 +210,8 @@ namespace date_time {
return time_rep_type(base.time_count() - (dd.days() * time_rep_type::frac_sec_per_day()));
}
}
static BOOST_CXX14_CONSTEXPR
time_rep_type subtract_time_duration(const time_rep_type& base,
const time_duration_type& td)
static time_rep_type subtract_time_duration(const time_rep_type& base,
const time_duration_type& td)
{
if(base.is_special() || td.is_special()) {
return(time_rep_type(base.get_rep() - td.get_rep()));
@@ -233,9 +220,8 @@ namespace date_time {
return time_rep_type(base.time_count() - td.ticks());
}
}
static BOOST_CXX14_CONSTEXPR
time_rep_type add_time_duration(const time_rep_type& base,
time_duration_type td)
static time_rep_type add_time_duration(const time_rep_type& base,
time_duration_type td)
{
if(base.is_special() || td.is_special()) {
return(time_rep_type(base.get_rep() + td.get_rep()));
@@ -244,9 +230,8 @@ namespace date_time {
return time_rep_type(base.time_count() + td.ticks());
}
}
static BOOST_CXX14_CONSTEXPR
time_duration_type subtract_times(const time_rep_type& lhs,
const time_rep_type& rhs)
static time_duration_type subtract_times(const time_rep_type& lhs,
const time_rep_type& rhs)
{
if(lhs.is_special() || rhs.is_special()) {
return(time_duration_type(
@@ -254,10 +239,10 @@ namespace date_time {
}
else {
fractional_seconds_type fs = lhs.time_count() - rhs.time_count();
return time_duration_type(0,0,0,fs);
return time_duration_type(0,0,0,fs);
}
}
};

Some files were not shown because too many files have changed in this diff Show More