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: mbed mbed-rtos SDFileSystem PinDetect ESP8266NodeMCUInterface
HistoryCache.h
00001 #include <iostream> 00002 #include <string> 00003 #include <cstring> 00004 #include <ctime> 00005 00006 class HistoryCache 00007 { 00008 00009 public: 00010 static char *strptime(const char * __restrict, const char * __restrict, struct tm * __restrict); 00011 00012 static std::string getTimeStamp(time_t epochTime, const char* format = "%Y-%m-%d %H:%M:%S") 00013 { 00014 char timestamp[64] = {0}; 00015 strftime(timestamp, sizeof(timestamp), format, localtime(&epochTime)); 00016 return timestamp; 00017 } 00018 00019 static time_t convertTimeToEpoch(const char* theTime, const char* format = "%Y-%m-%d %H:%M:%S") 00020 { 00021 std::tm tmTime; 00022 memset(&tmTime, 0, sizeof(tmTime)); 00023 HistoryCache::strptime(theTime, format, &tmTime); 00024 return mktime(&tmTime); 00025 } 00026 };
Generated on Sat Jul 16 2022 05:18:23 by
1.7.2