Jack Hansdampf / mbed-mqtt-GSOE1

Dependents:   ESP8266MQTT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LTimer.h Source File

LTimer.h

00001 /**************************************************************************************
00002  * Copyright (c) 2016, Tomoaki Yamaguchi
00003  *
00004  * All rights reserved. This program and the accompanying materials
00005  * are made available under the terms of the Eclipse Public License v1.0
00006  * and Eclipse Distribution License v1.0 which accompany this distribution.
00007  *
00008  * The Eclipse Public License is available at
00009  *    http://www.eclipse.org/legal/epl-v10.html
00010  * and the Eclipse Distribution License is available at
00011  *   http://www.eclipse.org/org/documents/edl-v10.php.
00012  *
00013  * Contributors:
00014  *    Tomoaki Yamaguchi - initial API and implementation and/or initial documentation
00015  **************************************************************************************/
00016 
00017 #ifndef TIMER_H_
00018 #define TIMER_H_
00019 
00020 #include <time.h>
00021 
00022 #include "LMqttsnClientApp.h"
00023 
00024 namespace linuxAsyncClient {
00025 
00026 /*============================================
00027                 LTimer
00028  ============================================*/
00029 class LTimer{
00030 public:
00031     LTimer();
00032     ~LTimer();
00033     void start(uint32_t msec = 0);
00034     bool isTimeUp(uint32_t msec);
00035     bool isTimeUp(void);
00036     void stop(void);
00037     void changeUTC(void){};
00038     uint32_t getRemain(void);
00039     static void setUnixTime(uint32_t utc){};
00040 private:
00041     struct timeval _startTime;
00042     uint32_t _millis;
00043 };
00044 
00045 } /* end of namespace */
00046 
00047 #endif /* TIMER_H_ */