123

Dependencies:   MQTTSN

Files at this revision

API Documentation at this revision

Comitter:
mapellil
Date:
Tue Jan 10 09:20:31 2017 +0000
Parent:
8:74b827befe72
Child:
10:cc61a766cd1f
Commit message:
Added set time on Wifi module

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jan 05 09:39:03 2017 +0000
+++ b/main.cpp	Tue Jan 10 09:20:31 2017 +0000
@@ -144,8 +144,10 @@
     int t=0;
     scanf("%d",&t);
     printf ("entered time is: %d \n\r", t);
-    if (t != 0) { time_t txTm = t; set_time(txTm); }
-    printf ("The current system time is: %s", ctime (&ctTime));
+    if (t != 0) { time_t txTm = t; set_time(txTm); }  // set Nucleo system time
+    ctTime = time(NULL);    
+    printf ("The current system time is: %s", ctime (&ctTime));  // set WiFi module systm time
+    if (!spwf.set_time(ctTime)) printf ("ERROR set_time\n\r");       
     if (!spwf.clean_TLS_certificate(ALL)) printf ("ERROR clean_TLS_certificate\n\r");
     if (!spwf.set_TLS_certificate(CA_cert, sizeof(CA_cert), FLASH_CA_ROOT_CERT)) printf ("ERROR set_TLS_certificate\n\r");
     if (!spwf.set_TLS_SRV_domain("www.amazon.it",FLASH_DOMAIN)) printf ("ERROR set_TLS_CA_domain\n\r");