1 /*
2 * Copyright (C) 2022 HiHope Open Source Organization .
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http:// www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 *
14 * limitations under the License.
15 */
16 #include "sntp_port.h"
17 #include "lwip/apps/sntp_opts.h"
18 #include "lwip/pbuf.h"
19 #include "lwip/dns.h"
20 #include "lwip/netdb.h"
21 #define ONE_THOUSAND_NINE_HUNDRED
22 #if SNTP_SERVER_DNS
23
24 #endif
25
26 #if defined(LWIP_DEBUG) && !defined(sntp_format_time)
27 #include <time.h>
28
ctime(const time_t *t)29 char *ctime(const time_t *t)
30 {
31 struct tm tm = {0};
32 localtime_r(t, &tm);
33
34 static char buff[32];
35 if (snprintf_s(buff, sizeof(buff), "%04d-%02d-%02d %02d:%02d:%02d",
36 ONE_THOUSAND_NINE_HUNDRED + tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec) == TRUE) {
37 }
38 return buff;
39 }
40
41 #endif
42