mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
revert r14081 because we always have localtime_r.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14083 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2006-05-16 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* lib/libqof/qof/gnc-date.c:
|
||||
revert r14081 because we always have localtime_r.
|
||||
|
||||
2006-05-16 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* lib/libqof/qof/gnc-date.c (timespecCanonicalDayTime)
|
||||
|
||||
+16
-56
@@ -249,17 +249,9 @@ Timespec
|
||||
timespecCanonicalDayTime(Timespec t)
|
||||
{
|
||||
struct tm tm;
|
||||
#ifndef HAVE_LOCALTIME_R
|
||||
struct tm *result;
|
||||
#endif
|
||||
Timespec retval;
|
||||
time_t t_secs = t.tv_sec + (t.tv_nsec / NANOS_PER_SECOND);
|
||||
#ifndef HAVE_LOCALTIME_R
|
||||
result = localtime(&t_secs);
|
||||
tm = *result;
|
||||
#else
|
||||
localtime_r(&t_secs, &tm);
|
||||
#endif
|
||||
gnc_tm_set_day_middle(&tm);
|
||||
retval.tv_sec = mktime(&tm);
|
||||
retval.tv_nsec = 0;
|
||||
@@ -503,24 +495,16 @@ qof_print_date_dmy_buff (char * buff, size_t len, int day, int month, int year)
|
||||
size_t
|
||||
qof_print_date_buff (char * buff, size_t len, time_t t)
|
||||
{
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
struct tm theTime_tm;
|
||||
#endif
|
||||
struct tm *theTime;
|
||||
struct tm theTime;
|
||||
|
||||
if (!buff) return 0 ;
|
||||
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
localtime_r (&t, &theTime_tm);
|
||||
theTime = &theTime_tm;
|
||||
#else
|
||||
theTime = localtime (&t);
|
||||
#endif
|
||||
localtime_r(&t, &theTime);
|
||||
|
||||
return qof_print_date_dmy_buff (buff, len,
|
||||
theTime->tm_mday,
|
||||
theTime->tm_mon + 1,
|
||||
theTime->tm_year + 1900);
|
||||
theTime.tm_mday,
|
||||
theTime.tm_mon + 1,
|
||||
theTime.tm_year + 1900);
|
||||
}
|
||||
|
||||
size_t
|
||||
@@ -954,21 +938,13 @@ char dateSeparator (void)
|
||||
else
|
||||
{ /* Make a guess */
|
||||
unsigned char string[256];
|
||||
struct tm *tm;
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
struct tm struct_tm;
|
||||
#endif
|
||||
struct tm tm;
|
||||
time_t secs;
|
||||
unsigned char *s;
|
||||
|
||||
secs = time(NULL);
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
localtime_r(&secs, &struct_tm);
|
||||
tm = &struct_tm;
|
||||
#else
|
||||
tm = localtime(&secs);
|
||||
#endif
|
||||
strftime(string, sizeof(string), GNC_D_FMT, tm);
|
||||
localtime_r(&secs, &tm);
|
||||
strftime(string, sizeof(string), GNC_D_FMT, &tm);
|
||||
|
||||
for (s = string; s != '\0'; s++)
|
||||
if (!isdigit(*s))
|
||||
@@ -1214,38 +1190,22 @@ gnc_timespec_to_iso8601_buff (Timespec ts, char * buff)
|
||||
int
|
||||
gnc_timespec_last_mday (Timespec t)
|
||||
{
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
struct tm tm;
|
||||
#endif
|
||||
struct tm *result;
|
||||
struct tm result;
|
||||
time_t t_secs = t.tv_sec + (t.tv_nsec / NANOS_PER_SECOND);
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
localtime_r(&t_secs, &tm);
|
||||
result = &tm;
|
||||
#else
|
||||
result = localtime(&t_secs);
|
||||
#endif
|
||||
return date_get_last_mday (result);
|
||||
localtime_r(&t_secs, &result);
|
||||
return date_get_last_mday (&result);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_timespec2dmy (Timespec t, int *day, int *month, int *year)
|
||||
{
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
struct tm tm;
|
||||
#endif
|
||||
struct tm *result;
|
||||
struct tm result;
|
||||
time_t t_secs = t.tv_sec + (t.tv_nsec / NANOS_PER_SECOND);
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
localtime_r(&t_secs, &tm);
|
||||
result = &tm;
|
||||
#else
|
||||
result = localtime(&t_secs);
|
||||
#endif
|
||||
localtime_r(&t_secs, &result);
|
||||
|
||||
if (day) *day = result->tm_mday;
|
||||
if (month) *month = result->tm_mon+1;
|
||||
if (year) *year = result->tm_year+1900;
|
||||
if (day) *day = result.tm_mday;
|
||||
if (month) *month = result.tm_mon+1;
|
||||
if (year) *year = result.tm_year+1900;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
|
||||
Reference in New Issue
Block a user