kopia lustrzana https://github.com/Hamlib/Hamlib
rodzic
cb80f2b18d
commit
c67f21bf96
|
@ -2430,23 +2430,26 @@ char *date_strget(char *buf, int buflen, int localtime)
|
||||||
time_t t;
|
time_t t;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
struct tm result;
|
struct tm result;
|
||||||
|
int mytimezone;
|
||||||
|
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
|
|
||||||
if (localtime)
|
if (localtime)
|
||||||
{
|
{
|
||||||
mytm = localtime_r(&t, &result);
|
mytm = localtime_r(&t, &result);
|
||||||
|
mytimezone = timezone;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mytm = gmtime_r(&t, &result);
|
mytm = gmtime_r(&t, &result);
|
||||||
|
mytimezone = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
strftime(buf, buflen, "%Y-%m-%dT%H:%M:%S.", mytm);
|
strftime(buf, buflen, "%Y-%m-%dT%H:%M:%S.", mytm);
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
snprintf(tmpbuf, sizeof(tmpbuf), "%06ld", (long)tv.tv_usec);
|
snprintf(tmpbuf, sizeof(tmpbuf), "%06ld", (long)tv.tv_usec);
|
||||||
strcat(buf, tmpbuf);
|
strcat(buf, tmpbuf);
|
||||||
snprintf(tmpbuf, sizeof(tmpbuf), "%s%04d", timezone >=0? "-":"+", ((int)abs(timezone)/3600)*100);
|
snprintf(tmpbuf, sizeof(tmpbuf), "%s%04d", mytimezone >=0? "-":"+", ((int)abs(mytimezone)/3600)*100);
|
||||||
strcat(buf, tmpbuf);
|
strcat(buf, tmpbuf);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue