You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MigrationGuide.md
+2-21Lines changed: 2 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,7 @@ With coreSNTP versions >=v2.0.0, there are breaking changes that need to be addr
6
6
7
7
* The `Sntp_ConvertToUnixTime` function now uses `uint32_t *` instead of `UnixTime_t *` for the Unix time seconds parameter. This change was made because:
8
8
- A `uint32_t` Unix timestamp can represent dates until February 7, 2106 06:28:15 UTC
9
-
- Beyond this date, we cannot differentiate between NTP era 0 and era 1 timestamps
10
-
- This provides a more accurate representation of the library's actual capabilities
9
+
- Beyond this date, we cannot differentiate between NTP era 0 and era 1 timestamps, thus it does not need to be a `uint64_t`
11
10
12
11
Thus, the signature of `Sntp_ConvertToUnixTime` changed from:
13
12
```c
@@ -36,12 +35,6 @@ SntpStatus_t status;
36
35
// Assume sntpTime has been populated from an SNTP response
37
36
38
37
status = Sntp_ConvertToUnixTime( &sntpTime, &unixTimeSecs, &unixTimeMicrosecs );
39
-
40
-
if( status == SntpSuccess )
41
-
{
42
-
// Use the Unix time
43
-
printf( "Unix time: %llu.%06u\n", ( unsigned long long ) unixTimeSecs, unixTimeMicrosecs );
44
-
}
45
38
```
46
39
47
40
**New Code Snippet**:
@@ -54,16 +47,4 @@ SntpStatus_t status;
54
47
// Assume sntpTime has been populated from an SNTP response
55
48
56
49
status = Sntp_ConvertToUnixTime( &sntpTime, &unixTimeSecs, &unixTimeMicrosecs );
***Year 2038 Problem Fixed**: The library now properly handles timestamps beyond January 19, 2038 03:14:07 UTC (the traditional Unix timestamp overflow point for 32-bit signed integers). The library uses unsigned 32-bit integers and can represent dates until February 7, 2106.
68
-
69
-
***Improved Time Conversion**: The `Sntp_ConvertToUnixTime` function now includes proper overflow and underflow checking to ensure time conversions are handled safely.
0 commit comments