YSTest: ctime.h 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

ctime.h
浏览该文件的文档.
1 /*
2 © 2016 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YB_INC_ystdex_ctime_h_
29 #define YB_INC_ystdex_ctime_h_ 1
30
31 #include "../ydef.h" // for yconstfn;
32 #include <ctime> // for std::tm;
33
34 namespace ystdex
35 {
36
38
39 yconstfn bool
41 is_date_range_valid(const std::tm& t)
42 {
43 return !(t.tm_mon < 0 || 12 < t.tm_mon || t.tm_mday < 1 || 31 < t.tm_mday);
44 }
45
47 yconstfn bool
48 is_time_no_leap_valid(const std::tm& t)
49 {
50 return !(t.tm_hour < 0 || 23 < t.tm_hour || t.tm_hour < 0 || 59 < t.tm_min
51 || t.tm_sec < 0 || 59 < t.tm_min);
52 }
54
55 } // namespace ystdex;
56
57 #endif
58
NPL::tm
tm
Definition: NPLA.h:1941
ystdex::is_time_no_leap_valid
bool is_time_no_leap_valid(const std::tm &t)
判断 std::tm 的时间数据成员范围是否有效。
Definition: ctime.h:48
ystdex
<memory> 特性测试宏。
Definition: ydef.h:1262
ystdex::is_date_range_valid
bool is_date_range_valid(const std::tm &t)
判断 std::tm 的日期数据成员范围是否有效。
Definition: ctime.h:41
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:1073