mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
times times times
This commit is contained in:
parent
22f8440183
commit
dae0016bb2
3 changed files with 35 additions and 20 deletions
|
@ -6,8 +6,8 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency T55xx commands
|
// Low frequency T55xx commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/* Ensure localtime_r is available even with -std=c99; must be included before
|
|
||||||
*/
|
// ensure localtime_r is available even with -std=c99; must be included before
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#define _POSIX_C_SOURCE 200112L
|
#define _POSIX_C_SOURCE 200112L
|
||||||
#endif
|
#endif
|
||||||
|
@ -1205,10 +1205,15 @@ static int CmdT55xxReadTrace(const char *Cmd) {
|
||||||
si += 5;
|
si += 5;
|
||||||
data.dw = PackBits(si, 15, DemodBuffer);
|
data.dw = PackBits(si, 15, DemodBuffer);
|
||||||
|
|
||||||
struct tm *tm = NULL;
|
struct tm *ct, tm_buf;
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
localtime_r(&now, tm);
|
#if defined(_WIN32)
|
||||||
if (data.year > tm->tm_year - 110)
|
ct = localtime_s(&tm_buf, &now) == 0 ? &tm_buf : NULL;
|
||||||
|
#else
|
||||||
|
ct = localtime_r(&now, &tm_buf);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (data.year > ct->tm_year - 110)
|
||||||
data.year += 2000;
|
data.year += 2000;
|
||||||
else
|
else
|
||||||
data.year += 2010;
|
data.year += 2010;
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
// 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)
|
||||||
#define _POSIX_C_SOURCE 200112L
|
#define _POSIX_C_SOURCE 200112L
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,13 +18,15 @@
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
static int CmdRem(const char *Cmd) {
|
static int CmdRem(const char *Cmd) {
|
||||||
char buf[22];
|
char buf[22] = {0};
|
||||||
|
struct tm *ct, tm_buf;
|
||||||
memset(buf, 0x00, sizeof(buf));
|
|
||||||
struct tm *curTime = NULL;
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
gmtime_r(&now, curTime);
|
#if defined(_WIN32)
|
||||||
strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", curTime); // ISO8601
|
ct = gmtime_s(&tm_buf, &now) == 0 ? &tm_buf : NULL;
|
||||||
|
#else
|
||||||
|
ct = gmtime_r(&now, &tm_buf);
|
||||||
|
#endif
|
||||||
|
strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", ct); // ISO8601
|
||||||
PrintAndLogEx(NORMAL, "%s remark: %s", buf, Cmd);
|
PrintAndLogEx(NORMAL, "%s remark: %s", buf, Cmd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// utilities
|
// utilities
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// ensure gmtime_r is available even with -std=c99; must be included before
|
||||||
|
#if !defined(_WIN32)
|
||||||
|
#define _POSIX_C_SOURCE 200112L
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define UTIL_BUFFER_SIZE_SPRINT 4097
|
#define UTIL_BUFFER_SIZE_SPRINT 4097
|
||||||
|
@ -92,12 +98,15 @@ void AddLogUint64(const char *fn, const char *data, const uint64_t value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddLogCurrentDT(const char *fn) {
|
void AddLogCurrentDT(const char *fn) {
|
||||||
char buf[20];
|
char buf[20] = {0};
|
||||||
memset(buf, 0x00, sizeof(buf));
|
struct tm *ct, tm_buf;
|
||||||
struct tm *curTime;
|
time_t now = time(NULL);
|
||||||
time_t now = time(0);
|
#if defined(_WIN32)
|
||||||
curTime = gmtime(&now);
|
ct = gmtime_s(&tm_buf, &now) == 0 ? &tm_buf : NULL;
|
||||||
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", curTime);
|
#else
|
||||||
|
ct = gmtime_r(&now, &tm_buf);
|
||||||
|
#endif
|
||||||
|
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", ct);
|
||||||
AddLogLine(fn, "\nanticollision: ", buf);
|
AddLogLine(fn, "\nanticollision: ", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue