Skip to content

Commit ca6b64c

Browse files
committed
Clean up time header declarations
This patch modernizes the libc time headers by updating the copyright year, normalizing formatting, and renaming function parameters for clarity. It also aligns the `struct timeval` and `struct timezone` declarations with common C style conventions while keeping the public API unchanged.
1 parent a06a7fe commit ca6b64c

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

include/sys/time.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file time.h
33
*
44
*/
5-
/* Copyright (C) 2020 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2020-2026 by Arjan van Vught mailto:info@gd32-dmx.org
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -27,31 +27,31 @@
2727
#define SYS_TIME_H_
2828

2929
#ifndef _TIME_T
30-
#define _TIME_T
30+
#define _TIME_T
3131
typedef long time_t;
32-
#endif /* _TIME_T */
32+
#endif /* _TIME_T */
3333

34-
#ifndef _SUSECONDS_T
35-
#define _SUSECONDS_T
34+
#ifndef _SUSECONDS_T
35+
#define _SUSECONDS_T
3636
typedef long suseconds_t;
37-
#endif /* _SUSECONDS_T */
37+
#endif /* _SUSECONDS_T */
3838

39-
struct timeval {
40-
time_t tv_sec; /* seconds */
41-
suseconds_t tv_usec; /* microseconds */
39+
struct timeval { // NOLINT
40+
time_t tv_sec; // seconds
41+
suseconds_t tv_usec; // microseconds
4242
};
4343

44-
struct timezone {
45-
int tz_minuteswest; /* minutes west of Greenwich */
46-
int tz_dsttime; /* type of DST correction */
44+
struct timezone { // NOLINT
45+
int tz_minuteswest; // minutes west of Greenwich
46+
int tz_dsttime; // type of DST correction
4747
};
4848

4949
#ifdef __cplusplus
5050
extern "C" {
5151
#endif
5252

53-
extern int gettimeofday(struct timeval *tv, struct timezone *tz);
54-
extern int settimeofday(const struct timeval *tv, const struct timezone *tz);
53+
extern int gettimeofday(struct timeval* time_val, struct timezone* time_zone); // NOLINT
54+
extern int settimeofday(const struct timeval* time_val, const struct timezone* time_zone); // NOLINT
5555

5656
#ifdef __cplusplus
5757
}

include/time.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ typedef enum {
5959
extern "C" {
6060
#endif
6161

62-
extern time_t time(time_t *t);
62+
extern time_t time(time_t *timer);
6363
extern time_t mktime(struct tm *tm);
6464
extern struct tm *gmtime(const time_t *timep);
6565
extern struct tm *localtime(const time_t *timep);

0 commit comments

Comments
 (0)