1 /*
2  * Copyright (C) 2015-2021 Alibaba Group Holding Limited
3  */
4 
5 #include "sntp/sntp.h"
6 #if AOS_COMP_CLI
7 #include "aos/cli.h"
8 #endif
9 
sntp_comp_example(int argc,char ** argv)10 static void sntp_comp_example(int argc, char **argv)
11 {
12     printf("sntp test \r\n");
13 
14     sntp_request(NULL);
15 
16     sntp_time *sntp_time_get;
17     sntp_time_get = sntp_obtain_time();
18 
19     printf("%d-%d-%d: week: %d, %d:%d:%d\r\n",
20                  sntp_time_get->year,
21                  sntp_time_get->mon,
22                  sntp_time_get->day,
23                  sntp_time_get->week,
24                  sntp_time_get->hour,
25                  sntp_time_get->min,
26                  sntp_time_get->sec);
27 }
28 
29 
30 #if AOS_COMP_CLI
31 /* reg args: fun, cmd, description*/
32 ALIOS_CLI_CMD_REGISTER(sntp_comp_example, sntp_example, sntp component base example)
33 #endif
34