MQTT library (clone of https://os.mbed.com/teams/mqtt/code/MQTT/)

Dependencies:   FP MQTTPacket

Dependents:   NuMaker-mbed-AWS-IoT-example NuMaker-mbed-OS-6-AWS-IoT-example

Files at this revision

API Documentation at this revision

Comitter:
SHLIU1@OANBE02333.nuvoton.com
Date:
Wed Sep 07 13:40:01 2022 +0800
Parent:
64:1d9e7bec2a54
Commit message:
delete the setting of "chrono::duration_castchrono::milliseconds"

Changed in this revision

MQTTmbed.h Show annotated file Show diff for this revision Revisions of this file
diff -r 1d9e7bec2a54 -r 1b626554f238 MQTTmbed.h
--- a/MQTTmbed.h	Thu Sep 01 15:33:35 2022 +0800
+++ b/MQTTmbed.h	Wed Sep 07 13:40:01 2022 +0800
@@ -19,8 +19,7 @@
 
     bool expired()
     {
-        //return t.read_ms() >= interval_end_ms;
-        return chrono::duration_cast<chrono::milliseconds>(t.elapsed_time()).count() >= interval_end_ms;
+        return (t.elapsed_time()).count()/1000 >= interval_end_ms;
     }
     
     void countdown_ms(unsigned long ms)  
@@ -38,8 +37,7 @@
     
     int left_ms()
     {
-        //return interval_end_ms - t.read_ms();
-        return interval_end_ms - chrono::duration_cast<chrono::milliseconds>(t.elapsed_time()).count();
+        return interval_end_ms - (t.elapsed_time()).count()/1000;
     }
     
 private: