File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ int year(unsigned long t)
50
50
{
51
51
struct tm * tm = tTm (t);
52
52
53
- return (tm ->tm_year + YEAR_OFFSET);
53
+ return (tm ) ? ( tm ->tm_year + YEAR_OFFSET) : - 1 ;
54
54
}
55
55
56
56
int month ()
@@ -64,7 +64,7 @@ int month(unsigned long t)
64
64
{
65
65
struct tm * tm = tTm (t);
66
66
67
- return (tm ->tm_mon + MONTH_OFFSET);
67
+ return (tm ) ? ( tm ->tm_mon + MONTH_OFFSET) : - 1 ;
68
68
}
69
69
70
70
int day ()
@@ -78,7 +78,7 @@ int day(unsigned long t)
78
78
{
79
79
struct tm * tm = tTm (t);
80
80
81
- return tm ->tm_mday ;
81
+ return ( tm ) ? tm ->tm_mday : - 1 ;
82
82
}
83
83
84
84
int hour ()
@@ -92,7 +92,7 @@ int hour(unsigned long t)
92
92
{
93
93
struct tm * tm = tTm (t);
94
94
95
- return tm ->tm_hour ;
95
+ return ( tm ) ? tm ->tm_hour : - 1 ;
96
96
}
97
97
98
98
int minute ()
@@ -106,7 +106,7 @@ int minute(unsigned long t)
106
106
{
107
107
struct tm * tm = tTm (t);
108
108
109
- return tm ->tm_min ;
109
+ return ( tm ) ? tm ->tm_min : - 1 ;
110
110
}
111
111
112
112
int second ()
@@ -120,7 +120,7 @@ int second(unsigned long t)
120
120
{
121
121
struct tm * tm = tTm (t);
122
122
123
- return tm ->tm_sec ;
123
+ return ( tm ) ? tm ->tm_sec : - 1 ;
124
124
}
125
125
126
126
void setTime (unsigned long t)
You can’t perform that action at this time.
0 commit comments