mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
localtime, gmtime replaced
This commit is contained in:
parent
361cd83fce
commit
1cb83e78a5
2 changed files with 11 additions and 5 deletions
|
@ -6,6 +6,12 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency T55xx commands
|
// Low frequency T55xx commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
/* Ensure localtime_r is available even with -std=c99; must be included before
|
||||||
|
*/
|
||||||
|
#if !defined(_WIN32)
|
||||||
|
#define _POSIX_C_SOURCE 200112L
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "cmdlft55xx.h"
|
#include "cmdlft55xx.h"
|
||||||
|
|
||||||
// Default configuration
|
// Default configuration
|
||||||
|
@ -1199,9 +1205,10 @@ static int CmdT55xxReadTrace(const char *Cmd) {
|
||||||
si += 5;
|
si += 5;
|
||||||
data.dw = PackBits(si, 15, DemodBuffer);
|
data.dw = PackBits(si, 15, DemodBuffer);
|
||||||
|
|
||||||
time_t t = time(NULL);
|
struct tm *t = NULL;
|
||||||
struct tm tm = *localtime(&t);
|
time_t now = time(NULL);
|
||||||
if (data.year > tm.tm_year - 110)
|
localtime_r(&now, t);
|
||||||
|
if (data.year > t.tm_year - 110)
|
||||||
data.year += 2000;
|
data.year += 2000;
|
||||||
else
|
else
|
||||||
data.year += 2010;
|
data.year += 2010;
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
// Main command parser entry point
|
// Main command parser entry point
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/* Ensure gmtime_r is available even with -std=c99; must be included before
|
/* Ensure gmtime_r is available even with -std=c99; must be included before
|
||||||
*/
|
*/
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
@ -24,7 +23,7 @@ static int CmdRem(const char *Cmd) {
|
||||||
|
|
||||||
memset(buf, 0x00, sizeof(buf));
|
memset(buf, 0x00, sizeof(buf));
|
||||||
struct tm *curTime = NULL;
|
struct tm *curTime = NULL;
|
||||||
time_t now = time(0);
|
time_t now = time(NULL);
|
||||||
gmtime_r(&now, curTime);
|
gmtime_r(&now, curTime);
|
||||||
strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", curTime); // ISO8601
|
strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", curTime); // ISO8601
|
||||||
PrintAndLogEx(NORMAL, "%s remark: %s", buf, Cmd);
|
PrintAndLogEx(NORMAL, "%s remark: %s", buf, Cmd);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue