Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
545ad2fd
Commit
545ad2fd
authored
Feb 08, 2022
by
Eric Duminil
Browse files
Removing stupid snprintf warnings
parent
34f1ecd4
Pipeline
#5756
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/src/lib/NTPClient/NTPClient.cpp
View file @
545ad2fd
...
...
@@ -227,7 +227,8 @@ void NTPClient::getFormattedTime(char *formatted_time, unsigned long secs) {
// Based on https://github.com/PaulStoffregen/Time/blob/master/Time.cpp
void
NTPClient
::
getFormattedDate
(
char
*
formatted_date
,
unsigned
long
secs
)
{
unsigned
long
rawTime
=
(
secs
?
secs
:
this
->
getEpochTime
())
/
86400L
;
// in days
unsigned
long
days
=
0
,
year
=
1970
;
unsigned
long
days
=
0
;
unsigned
int
year
=
1970
;
uint8_t
month
;
static
const
uint8_t
monthDays
[]
=
{
31
,
28
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
};
...
...
@@ -250,7 +251,7 @@ void NTPClient::getFormattedDate(char *formatted_date, unsigned long secs) {
char
formatted_time
[
9
];
this
->
getFormattedTime
(
formatted_time
,
secs
);
snprintf
(
formatted_date
,
23
,
"%4
lu
-%02d-%02lu %s%+03d"
,
year
,
month
,
rawTime
,
formatted_time
,
this
->
_timeOffset
/
3600
);
snprintf
(
formatted_date
,
23
,
"%4
d
-%02d-%02lu %s%+03d"
,
year
,
month
,
rawTime
,
formatted_time
,
(
int8_t
)
this
->
_timeOffset
/
3600
);
}
void
NTPClient
::
setEpochTime
(
unsigned
long
secs
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment