]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/include/c_std/bits/std_ctime.h
1 // -*- C++ -*- header wrapper.
3 // Copyright (C) 1997-1999, 2000 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: 20.5 Date and time
37 # ifdef _IN_C_LEGACY_ /* sub-included by a C header */
38 // get out of the "legacy"
40 } // close namespace _C_legacy::
42 # define _TIME_NEED_C_LEGACY_
45 # include <bits/std_cstddef.h>
49 # define _IN_C_LEGACY_
50 # pragma GCC system_header
53 // glibc 2.1.x time.h is on crack
55 # undef __need_clock_t
56 # undef __need_timespec
58 # include_next <time.h>
61 typedef clock_t _CPP_clock_t_capture
;
62 typedef time_t _CPP_time_t_capture
;
63 typedef tm _CPP_tm_capture
;
65 } // namespace _C_legacy
82 // Adopt C names into std::
83 typedef _C_legacy::_CPP_clock_t_capture
clock_t;
84 typedef _C_legacy::_CPP_time_t_capture
time_t;
85 struct tm
: _C_legacy::_CPP_tm_capture
{ };
87 using _C_legacy::clock
;
88 using _C_legacy::difftime
;
89 using _C_legacy::mktime
;
90 using _C_legacy::time
;
91 using _C_legacy::ctime
;
94 asctime(const tm
* __t
)
95 { return _C_legacy::asctime(static_cast<_C_legacy::_CPP_tm_capture
const*>(__t
)); }
98 gmtime(time_t const* __tp
)
99 { return reinterpret_cast<tm
*>(_C_legacy::gmtime(__tp
)); }
102 localtime(const time_t* __tp
)
103 { return reinterpret_cast<tm
*>(_C_legacy::localtime(__tp
)); }
106 strftime(char* __buf
, size_t __maxsz
, char const* __fmt
, tm
const* __tp
)
107 { return _C_legacy::strftime(__buf
, __maxsz
, __fmt
,
108 static_cast<_C_legacy::_CPP_tm_capture
const*>(__tp
)); }
112 # undef _IN_C_LEGACY_
114 // Expose global C names, including non-standard ones, but shadow
115 // some names and types with the std:: C++ version.
127 using std::localtime
;
130 # ifdef _TIME_NEED_C_LEGACY_
131 // dive back into the "swamp"
132 namespace _C_legacy
{
134 # define _IN_C_LEGACY_
135 # undef _TIME_NEED_C_LEGACY_
136 # endif /* _TIME_NEED_C_LEGACY_ */
138 #endif /*_CPP_CTIME*/