Skip to content

Commit 7fc3b0f

Browse files
author
czjaso
committed
Add migration guide for going to v2.x.x.
1 parent 00970d4 commit 7fc3b0f

1 file changed

Lines changed: 2 additions & 21 deletions

File tree

MigrationGuide.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ With coreSNTP versions >=v2.0.0, there are breaking changes that need to be addr
66

77
* The `Sntp_ConvertToUnixTime` function now uses `uint32_t *` instead of `UnixTime_t *` for the Unix time seconds parameter. This change was made because:
88
- 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`
1110

1211
Thus, the signature of `Sntp_ConvertToUnixTime` changed from:
1312
```c
@@ -36,12 +35,6 @@ SntpStatus_t status;
3635
// Assume sntpTime has been populated from an SNTP response
3736

3837
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-
}
4538
```
4639

4740
**New Code Snippet**:
@@ -54,16 +47,4 @@ SntpStatus_t status;
5447
// Assume sntpTime has been populated from an SNTP response
5548

5649
status = Sntp_ConvertToUnixTime( &sntpTime, &unixTimeSecs, &unixTimeMicrosecs );
57-
58-
if( status == SntpSuccess )
59-
{
60-
// Use the Unix time
61-
printf( "Unix time: %u.%06u\n", unixTimeSecs, unixTimeMicrosecs );
62-
}
63-
```
64-
65-
### Additional Changes
66-
67-
* **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.
50+
```

0 commit comments

Comments
 (0)