File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
pico_w/wifi/ntp_system_time Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,16 @@ int main() {
105105 get_time_utc (& ts );
106106
107107 // if you just want a string representation of the current time and you're not interested
108- // in the individual date/time fields, you could simply call ctime(&(ts.tv_sec)) here
109- // (if you have set 'TZ' then the result will be in local time, otherwise UTC)
110-
111- // unpack the individual date/time fields (if you have set 'TZ' then the values will be
112- // in local time, otherwise UTC)
108+ // in the individual date/time fields, then here you can simply call:
109+ // printf("%s", ctime(&(ts.tv_sec)));
110+ // The string produced is the same as `asctime()` as used below. Note that if you set
111+ // 'TZ' then the output will be in local time, otherwise UTC.
112+
113+ // you can unpack the raw UTC seconds count into individual date/time fields like this.
114+ // Again, if you set 'TZ' then the values will be in local time, otherwise UTC. Note
115+ // that by default `pico_localtime_r()` just calls `localtime_r()` from the standard 'C'
116+ // library, but the declaration is 'weak' so that a user can override it with their own
117+ // implementation if desired.
113118 pico_localtime_r (& (ts .tv_sec ), & tm );
114119
115120 // display individual date/time fields in human readable form
You can’t perform that action at this time.
0 commit comments