2525
2626#if !defined(CONFIG_NET_ENABLE_PTP)
2727#error
28- #endif
28+ #endif // CONFIG_NET_ENABLE_PTP
2929
3030#pragma GCC push_options
3131#pragma GCC optimize("O2")
4141#define enet_ptp_timestamp_function_config (x ) enet_ptp_timestamp_function_config(ENETx, x)
4242#define enet_ptp_timestamp_update_config (x, y, z ) enet_ptp_timestamp_update_config(ENETx, x, y, z)
4343#define enet_ptp_system_time_get (x ) enet_ptp_system_time_get(ENETx, x)
44- #endif
44+ #endif // GD32H7XX
4545
4646extern " C" {
4747/*
4848 * number of seconds and microseconds since the Epoch,
4949 * 1970-01-01 00:00:00 +0000 (UTC).
5050 */
5151
52- int gettimeofday (struct timeval * tv , [[maybe_unused]] struct timezone * tz ) {
53- assert (tv != 0 );
52+ int gettimeofday (struct timeval * time_val , [[maybe_unused]] struct timezone * time_zone ) { // NOLINT
53+ assert (time_val != nullptr );
5454
5555 enet_ptp_systime_struct systime;
5656 enet_ptp_system_time_get (&systime);
5757
58- tv ->tv_sec = static_cast <time_t >(systime.second );
58+ time_val ->tv_sec = static_cast <time_t >(systime.second );
5959
60- #if !defined( GD32F4XX)
60+ #ifndef GD32F4XX
6161 const auto kNanoSecond = systime.nanosecond ;
6262#else
6363 const auto kNanoSecond = gd32::PtpSubsecond2Nanosecond (systime.subsecond );
64- #endif
64+ #endif // GD32F4XX
6565
66- tv ->tv_usec = static_cast <time_t >(kNanoSecond / 1000U );
66+ time_val ->tv_usec = static_cast <time_t >(kNanoSecond / 1000U );
6767
6868 return 0 ;
6969}
7070
71- int settimeofday (const struct timeval * tv , [[maybe_unused]] const struct timezone * tz ) {
72- assert (tv != nullptr );
71+ int settimeofday (const struct timeval * time_val , [[maybe_unused]] const struct timezone * time_zone ) { // NOLINT
72+ assert (time_val != nullptr );
7373
7474 const uint32_t kSign = ENET_PTP_ADD_TO_TIME ;
75- const auto kSecond = static_cast <uint32_t >(tv ->tv_sec );
76- const uint32_t kNanoSecond = static_cast <uint32_t >(tv ->tv_usec ) * 1000U ;
75+ const auto kSecond = static_cast <uint32_t >(time_val ->tv_sec );
76+ const uint32_t kNanoSecond = static_cast <uint32_t >(time_val ->tv_usec ) * 1000U ;
7777 const auto kSubSecond = gd32::PtpNanosecond2Subsecond (kNanoSecond );
7878
7979 enet_ptp_timestamp_update_config (kSign , kSecond , kSubSecond );
@@ -85,10 +85,8 @@ int settimeofday(const struct timeval* tv, [[maybe_unused]] const struct timezon
8585 return -1 ;
8686}
8787
88- /*
89- * time() returns the time as the number of seconds since the Epoch,
90- 1970-01-01 00:00:00 +0000 (UTC).
91- */
88+ // time() returns the time as the number of seconds since the Epoch,
89+ // 1970-01-01 00:00:00 +0000 (UTC).
9290time_t time (time_t * __timer) { // NOLINT
9391 struct timeval tv;
9492 gettimeofday (&tv, nullptr );
0 commit comments