Skip to content

Commit

Permalink
lib/timeutil: support const correctness for pointer parameter
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pabigot authored and nashif committed Sep 20, 2019
1 parent 5bc06e8 commit cc1594a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/sys/timeutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extern "C" {
*
* @see http://man7.org/linux/man-pages/man3/timegm.3.html
*/
time_t timeutil_timegm(struct tm *tm);
time_t timeutil_timegm(const struct tm *tm);

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion lib/os/timeutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static s64_t time_days_from_civil(s64_t y,
* @return the signed number of seconds between 1970-01-01T00:00:00
* and the specified time ignoring leap seconds and DST offsets.
*/
time_t timeutil_timegm(struct tm *tm)
time_t timeutil_timegm(const struct tm *tm)
{
s64_t y = 1900 + (s64_t)tm->tm_year;
unsigned int m = tm->tm_mon + 1;
Expand Down

0 comments on commit cc1594a

Please sign in to comment.