1 // std::time_get, std::time_put implementation, GNU version -*- C++ -*-
3 // Copyright (C) 2001 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
31 // ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
32 // ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
35 // Written by Benjamin Kosnik <bkoz@redhat.com>
44 _M_put_helper(char* __s
, size_t __maxlen
, const char* __format
,
47 setlocale(LC_ALL
, _M_name_timepunct
);
48 strftime(__s
, __maxlen
, __format
, __tm
);
53 __timepunct
<char>::_M_initialize_timepunct(__c_locale
)
56 _M_date_format
= "%m/%d/%Y";
57 _M_date_era_format
= "%m/%d/%Y";
58 _M_time_format
= "%H:%M:%S";
59 _M_time_era_format
= "%H:%M:%S";
60 _M_date_time_format
= "";
61 _M_date_time_era_format
= "";
66 // Day names, starting with "C"'s Sunday.
70 _M_day4
= "Wednesday";
75 // Abbreviated day names, starting with "C"'s Sun.
84 // Month names, starting with "C"'s January.
85 _M_month01
= "January";
86 _M_month02
= "February";
92 _M_month08
= "August";
93 _M_month09
= "September";
94 _M_month10
= "October";
95 _M_month11
= "November";
96 _M_month12
= "December";
98 // Abbreviated month names, starting with "C"'s Jan.
100 _M_month_a02
= "Feb";
101 _M_month_a03
= "Mar";
102 _M_month_a04
= "Apr";
103 _M_month_a05
= "May";
104 _M_month_a06
= "Jun";
105 _M_month_a07
= "July";
106 _M_month_a08
= "Aug";
107 _M_month_a09
= "Sep";
108 _M_month_a10
= "Oct";
109 _M_month_a11
= "Nov";
110 _M_month_a12
= "Dec";
113 #ifdef _GLIBCPP_USE_WCHAR_T
116 __timepunct
<wchar_t>::
117 _M_put_helper(wchar_t* __s
, size_t __maxlen
, const wchar_t* __format
,
118 const tm
* __tm
) const
120 setlocale(LC_ALL
, _M_name_timepunct
);
121 wcsftime(__s
, __maxlen
, __format
, __tm
);
126 __timepunct
<wchar_t>::_M_initialize_timepunct(__c_locale
)
129 _M_date_format
= L
"%m/%d/%y";
130 _M_date_era_format
= L
"%m/%d/%y";
131 _M_time_format
= L
"%H:%M:%S";
132 _M_time_era_format
= L
"%H:%M:%S";
133 _M_date_time_format
= L
"";
134 _M_date_time_era_format
= L
"";
137 _M_am_pm_format
= L
"";
139 // Day names, starting with "C"'s Sunday.
142 _M_day3
= L
"Tuesday";
143 _M_day4
= L
"Wednesday";
144 _M_day5
= L
"Thursday";
146 _M_day7
= L
"Saturday";
148 // Abbreviated day names, starting with "C"'s Sun.
157 // Month names, starting with "C"'s January.
158 _M_month01
= L
"January";
159 _M_month02
= L
"February";
160 _M_month03
= L
"March";
161 _M_month04
= L
"April";
163 _M_month06
= L
"June";
164 _M_month07
= L
"July";
165 _M_month08
= L
"August";
166 _M_month09
= L
"September";
167 _M_month10
= L
"October";
168 _M_month11
= L
"November";
169 _M_month12
= L
"December";
171 // Abbreviated month names, starting with "C"'s Jan.
172 _M_month_a01
= L
"Jan";
173 _M_month_a02
= L
"Feb";
174 _M_month_a03
= L
"Mar";
175 _M_month_a04
= L
"Apr";
176 _M_month_a05
= L
"May";
177 _M_month_a06
= L
"Jun";
178 _M_month_a07
= L
"July";
179 _M_month_a08
= L
"Aug";
180 _M_month_a09
= L
"Sep";
181 _M_month_a10
= L
"Oct";
182 _M_month_a11
= L
"Nov";
183 _M_month_a12
= L
"Dec";