Skip to content

Commit daeb47a

Browse files
committed
Rename UTC offset variable and minor tidies
Rename global UTC offset from g_nUtcOffset to g_utc_offset across headers and sources (lib-hal/include/global.h, lib-hal/include/utc.h, lib-clib/src/time.cpp) and update all references (including Global accessor/mutator and localtime()). Also tweak an ERROR message in lib-network/src/core/udp.cpp (remove trailing newline) and update copyright metadata in lib-clib/src/strlen.cpp and lib-clib/src/time.cpp.
1 parent c119b9e commit daeb47a

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

lib-clib/src/strlen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file strlen.cpp
33
*
44
*/
5-
/* Copyright (C) 2023-2026 by Arjan van Vught mailto:info@orangepi-dmx.nl
5+
/* Copyright (C) 2023-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

lib-clib/src/time.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file time.cpp
33
*
44
*/
5-
/* Copyright (C) 2016-2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2016-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,7 +27,7 @@
2727
#include <time.h>
2828

2929
namespace global {
30-
int32_t g_nUtcOffset = 0;
30+
int32_t g_utc_offset = 0;
3131
} // namespace global
3232

3333
static constexpr int kDaysOfMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
@@ -56,7 +56,7 @@ struct tm* localtime(const time_t* t) {
5656
return nullptr;
5757
}
5858

59-
auto time = *t + global::g_nUtcOffset;
59+
auto time = *t + global::g_utc_offset;
6060
return gmtime(&time);
6161
}
6262

lib-hal/include/global.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
namespace global
2424
{
25-
extern int32_t g_nUtcOffset;
25+
extern int32_t g_utc_offset;
2626
}
2727

2828
/**
@@ -49,14 +49,14 @@ class Global
4949
* @brief Gets the current UTC offset in seconds.
5050
* @return UTC offset in seconds.
5151
*/
52-
int32_t GetUtcOffset() const { return global::g_nUtcOffset; }
52+
int32_t GetUtcOffset() const { return global::g_utc_offset; }
5353

5454
/**
5555
* @brief Gets the current UTC offset as (hours, minutes).
5656
* @param[out] hours Signed hour component.
5757
* @param[out] minutes Unsigned minute component.
5858
*/
59-
inline void GetUtcOffset(int32_t& hours, uint32_t& minutes) { hal::utc::SplitOffset(global::g_nUtcOffset, hours, minutes); }
59+
inline void GetUtcOffset(int32_t& hours, uint32_t& minutes) { hal::utc::SplitOffset(global::g_utc_offset, hours, minutes); }
6060

6161
/**
6262
* @brief Sets the global UTC offset if the value is valid.
@@ -67,7 +67,7 @@ class Global
6767
{
6868
if (hal::utc::IsValidOffset(utc_offset_seconds))
6969
{
70-
::global::g_nUtcOffset = utc_offset_seconds;
70+
::global::g_utc_offset = utc_offset_seconds;
7171
return true;
7272
}
7373
return false;

lib-hal/include/utc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace global
3737
/**
3838
* @brief The current UTC offset in seconds.
3939
*/
40-
extern int32_t g_nUtcOffset;
40+
extern int32_t g_utc_offset;
4141
} // namespace global
4242

4343
namespace hal::utc

lib-network/src/core/udp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ int32_t End(uint16_t localport) {
239239
}
240240
}
241241

242-
ERROR("Port not found.\n");
242+
ERROR("Port not found.");
243243
return -1;
244244
}
245245

0 commit comments

Comments
 (0)