diff --git b/libs/locale/src/std/codecvt.cpp a/libs/locale/src/std/codecvt.cpp
index 513d22f..8ea00aa 100644
|
b
|
a
|
namespace impl_std {
|
| 18 | 18 | std::locale codecvt_bychar( std::locale const &in, |
| 19 | 19 | std::string const &locale_name) |
| 20 | 20 | { |
| 21 | | return std::locale(in,new std::codecvt_byname<CharType,char,mbstate_t>(locale_name.c_str())); |
| | 21 | return std::locale(in,new std::codecvt_byname<CharType,char,std::mbstate_t>(locale_name.c_str())); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
diff --git b/libs/locale/src/util/codecvt_converter.cpp a/libs/locale/src/util/codecvt_converter.cpp
index 7a9aab2..8c7e25c 100644
|
b
|
a
|
namespace util {
|
| 70 | 70 | if(!utf::is_valid_codepoint(u)) |
| 71 | 71 | return illegal; |
| 72 | 72 | int width = utf::utf_traits<char>::width(u); |
| 73 | | ptrdiff_t d=end-begin; |
| | 73 | std::ptrdiff_t d=end-begin; |
| 74 | 74 | if(d < width) |
| 75 | 75 | return incomplete; |
| 76 | 76 | utf::utf_traits<char>::encode(u,begin); |
| … |
… |
namespace util {
|
| 229 | 229 | // Real codecvt |
| 230 | 230 | |
| 231 | 231 | template<typename CharType> |
| 232 | | class code_converter : public std::codecvt<CharType,char,mbstate_t> |
| | 232 | class code_converter : public std::codecvt<CharType,char,std::mbstate_t> |
| 233 | 233 | { |
| 234 | 234 | public: |
| 235 | 235 | code_converter(std::auto_ptr<base_converter> cvt,size_t refs = 0) : |
| 236 | | std::codecvt<CharType,char,mbstate_t>(refs), |
| | 236 | std::codecvt<CharType,char,std::mbstate_t>(refs), |
| 237 | 237 | cvt_(cvt) |
| 238 | 238 | { |
| 239 | 239 | max_len_ = cvt_->max_len(); |
| … |
… |
namespace util {
|
| 627 | 627 | |
| 628 | 628 | }; |
| 629 | 629 | |
| 630 | | static const char ensure_mbstate_size_is_at_least_2[sizeof(mbstate_t) >= 2 ? 1 : -1] = {0}; |
| | 630 | static const char ensure_mbstate_size_is_at_least_2[sizeof(std::mbstate_t) >= 2 ? 1 : -1] = {0}; |
| 631 | 631 | |
| 632 | 632 | template<> |
| 633 | | class code_converter<char> : public std::codecvt<char,char,mbstate_t> |
| | 633 | class code_converter<char> : public std::codecvt<char,char,std::mbstate_t> |
| 634 | 634 | { |
| 635 | 635 | public: |
| 636 | 636 | code_converter(std::auto_ptr<base_converter> /*cvt*/,size_t refs = 0) : |
| 637 | | std::codecvt<char,char,mbstate_t>(refs) |
| | 637 | std::codecvt<char,char,std::mbstate_t>(refs) |
| 638 | 638 | { |
| 639 | 639 | } |
| 640 | 640 | }; |
diff --git b/libs/locale/src/util/gregorian.cpp a/libs/locale/src/util/gregorian.cpp
index 4c7a8c1..9a99cab 100644
|
b
|
a
|
namespace util {
|
| 70 | 70 | return days[is_leap(year)][month-1] + day - 1; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | | time_t internal_timegm(std::tm const *t) |
| | 73 | std::time_t internal_timegm(std::tm const *t) |
| 74 | 74 | { |
| 75 | 75 | int year = t->tm_year + 1900; |
| 76 | 76 | int month = t->tm_mon; |
| … |
… |
namespace util {
|
| 88 | 88 | int day_of_year = days_from_1jan(year,month,day); |
| 89 | 89 | int days_since_epoch = days_from_1970(year) + day_of_year; |
| 90 | 90 | |
| 91 | | time_t seconds_in_day = 3600 * 24; |
| 92 | | time_t result = seconds_in_day * days_since_epoch + 3600 * t->tm_hour + 60 * t->tm_min + t->tm_sec; |
| | 91 | std::time_t seconds_in_day = 3600 * 24; |
| | 92 | std::time_t result = seconds_in_day * days_since_epoch + 3600 * t->tm_hour + 60 * t->tm_min + t->tm_sec; |
| 93 | 93 | |
| 94 | 94 | return result; |
| 95 | 95 | } |
| … |
… |
namespace util {
|
| 235 | 235 | std::tm val = tm_updated_; |
| 236 | 236 | val.tm_isdst = -1; |
| 237 | 237 | val.tm_wday = -1; // indecator of error |
| 238 | | time_t point = -1; |
| | 238 | std::time_t point = -1; |
| 239 | 239 | if(is_local_) { |
| 240 | 240 | point = mktime(&val); |
| 241 | | if(point == static_cast<time_t>(-1)){ |
| | 241 | if(point == static_cast<std::time_t>(-1)){ |
| 242 | 242 | #ifndef BOOST_WINDOWS |
| 243 | 243 | // windows does not handle negative time_t, under other plaforms |
| 244 | 244 | // it may be actually valid value in 1969-12-31 23:59:59 |
| … |
… |
namespace util {
|
| 318 | 318 | #ifdef BOOST_WINDOWS |
| 319 | 319 | return 1970; // Unix epoch windows can't handle negative time_t |
| 320 | 320 | #else |
| 321 | | if(sizeof(time_t) == 4) |
| | 321 | if(sizeof(std::time_t) == 4) |
| 322 | 322 | return 1901; // minimal year with 32 bit time_t |
| 323 | 323 | else |
| 324 | 324 | return 1; |
| … |
… |
namespace util {
|
| 326 | 326 | case absolute_maximum: |
| 327 | 327 | case least_maximum: |
| 328 | 328 | case actual_maximum: |
| 329 | | if(sizeof(time_t) == 4) |
| | 329 | if(sizeof(std::time_t) == 4) |
| 330 | 330 | return 2038; // Y2K38 - maximal with 32 bit time_t |
| 331 | 331 | else |
| 332 | 332 | return std::numeric_limits<int>::max(); |
| … |
… |
namespace util {
|
| 565 | 565 | /// |
| 566 | 566 | virtual void set_time(posix_time const &p) |
| 567 | 567 | { |
| 568 | | from_time(static_cast<time_t>(p.seconds)); |
| | 568 | from_time(static_cast<std::time_t>(p.seconds)); |
| 569 | 569 | } |
| 570 | 570 | virtual posix_time get_time() const |
| 571 | 571 | { |
| … |
… |
namespace util {
|
| 791 | 791 | |
| 792 | 792 | private: |
| 793 | 793 | |
| 794 | | void from_time(time_t point) |
| | 794 | void from_time(std::time_t point) |
| 795 | 795 | { |
| 796 | | time_t real_point = point + tzoff_; |
| | 796 | std::time_t real_point = point + tzoff_; |
| 797 | 797 | std::tm *t = 0; |
| 798 | 798 | #ifdef BOOST_WINDOWS |
| 799 | 799 | // Windows uses TLS, thread safe |
| … |
… |
namespace util {
|
| 811 | 811 | time_ = point; |
| 812 | 812 | } |
| 813 | 813 | int first_day_of_week_; |
| 814 | | time_t time_; |
| | 814 | std::time_t time_; |
| 815 | 815 | std::tm tm_; |
| 816 | 816 | std::tm tm_updated_; |
| 817 | 817 | bool normalized_; |
diff --git b/libs/locale/src/util/numeric.hpp a/libs/locale/src/util/numeric.hpp
index 3155dbc..ee5bb51 100644
|
b
|
a
|
|
| 14 | 14 | #include <boost/locale/info.hpp> |
| 15 | 15 | #include <sstream> |
| 16 | 16 | #include <vector> |
| | 17 | #include <ctime> |
| 17 | 18 | #include <stdlib.h> |
| 18 | 19 | |
| 19 | 20 | #include "timezone.hpp" |
| … |
… |
private:
|
| 177 | 178 | return out; |
| 178 | 179 | } |
| 179 | 180 | |
| 180 | | iter_type format_time(iter_type out,std::ios_base &ios,char_type fill,time_t time,char c) const |
| | 181 | iter_type format_time(iter_type out,std::ios_base &ios,char_type fill,std::time_t time,char c) const |
| 181 | 182 | { |
| 182 | 183 | string_type fmt; |
| 183 | 184 | fmt+=char_type('%'); |
| … |
… |
private:
|
| 185 | 186 | return format_time(out,ios,fill,time,fmt); |
| 186 | 187 | } |
| 187 | 188 | |
| 188 | | iter_type format_time(iter_type out,std::ios_base &ios,char_type fill,time_t time,string_type const &format) const |
| | 189 | iter_type format_time(iter_type out,std::ios_base &ios,char_type fill,std::time_t time,string_type const &format) const |
| 189 | 190 | { |
| 190 | 191 | std::string tz = ios_info::get(ios).time_zone(); |
| 191 | 192 | std::tm tm; |