Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ESP8266Interface MQTT mbed-rtos mbed-src
Fork of ESP8266_MQTT_HelloWorld by
Diff: Linux-example/LinuxMQTT.h
- Revision:
- 19:1174b87e2111
- Parent:
- 18:76d0899bc3ce
- Child:
- 20:181d85380c8f
diff -r 76d0899bc3ce -r 1174b87e2111 Linux-example/LinuxMQTT.h
--- a/Linux-example/LinuxMQTT.h Tue Jun 09 17:57:43 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#if !defined(LINUXMQTT_H)
-#define LINUXMQTT_H
-
-class Countdown
-{
-public:
- Countdown()
- {
-
- }
-
- Countdown(int ms)
- {
- countdown_ms(ms);
- }
-
-
- bool expired()
- {
- struct timeval now, res;
- gettimeofday(&now, NULL);
- timersub(&end_time, &now, &res);
- //printf("left %d ms\n", (res.tv_sec < 0) ? 0 : res.tv_sec * 1000 + res.tv_usec / 1000);
- //if (res.tv_sec > 0 || res.tv_usec > 0)
- // printf("expired %d %d\n", res.tv_sec, res.tv_usec);
- return res.tv_sec < 0 || (res.tv_sec == 0 && res.tv_usec <= 0);
- }
-
-
- void countdown_ms(int ms)
- {
- struct timeval now;
- gettimeofday(&now, NULL);
- struct timeval interval = {ms / 1000, (ms % 1000) * 1000};
- //printf("interval %d %d\n", interval.tv_sec, interval.tv_usec);
- timeradd(&now, &interval, &end_time);
- }
-
-
- void countdown(int seconds)
- {
- struct timeval now;
- gettimeofday(&now, NULL);
- struct timeval interval = {seconds, 0};
- timeradd(&now, &interval, &end_time);
- }
-
-
- int left_ms()
- {
- struct timeval now, res;
- gettimeofday(&now, NULL);
- timersub(&end_time, &now, &res);
- //printf("left %d ms\n", (res.tv_sec < 0) ? 0 : res.tv_sec * 1000 + res.tv_usec / 1000);
- return (res.tv_sec < 0) ? 0 : res.tv_sec * 1000 + res.tv_usec / 1000;
- }
-
-private:
-
- struct timeval end_time;
-};
-
-
-#endif
\ No newline at end of file
