Skip to content

Commit cc1594a

Browse files
pabigotnashif
authored andcommitted
lib/timeutil: support const correctness for pointer parameter
timeutil_timegm() does not modify the passed structure, so it should indicate that in the signature (even though the GNU extension does not). Signed-off-by: Peter A. Bigot <[email protected]>
1 parent 5bc06e8 commit cc1594a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/sys/timeutil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extern "C" {
3232
*
3333
* @see http://man7.org/linux/man-pages/man3/timegm.3.html
3434
*/
35-
time_t timeutil_timegm(struct tm *tm);
35+
time_t timeutil_timegm(const struct tm *tm);
3636

3737
#ifdef __cplusplus
3838
}

lib/os/timeutil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static s64_t time_days_from_civil(s64_t y,
4848
* @return the signed number of seconds between 1970-01-01T00:00:00
4949
* and the specified time ignoring leap seconds and DST offsets.
5050
*/
51-
time_t timeutil_timegm(struct tm *tm)
51+
time_t timeutil_timegm(const struct tm *tm)
5252
{
5353
s64_t y = 1900 + (s64_t)tm->tm_year;
5454
unsigned int m = tm->tm_mon + 1;

0 commit comments

Comments
 (0)