mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-26 02:40:43 -06:00
Use qof_strftime instead of strftime in the C source code.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15796 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
095c71a5f1
commit
e111fd32b0
@ -188,10 +188,10 @@ qsf_param_init(qsf_param *params)
|
||||
qsf_time_now_t = time(NULL);
|
||||
qsf_ts = g_new(Timespec, 1);
|
||||
timespecFromTime_t(qsf_ts, qsf_time_now_t);
|
||||
strftime(qsf_enquiry_date, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(&qsf_time_now_t));
|
||||
strftime(qsf_time_match, QSF_DATE_LENGTH, qsf_time_precision, gmtime(&qsf_time_now_t));
|
||||
strftime(qsf_time_string, QSF_DATE_LENGTH, "%F", gmtime(&qsf_time_now_t));
|
||||
strftime(qsf_time_now, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(&qsf_time_now_t));
|
||||
qof_strftime(qsf_enquiry_date, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(&qsf_time_now_t));
|
||||
qof_strftime(qsf_time_match, QSF_DATE_LENGTH, qsf_time_precision, gmtime(&qsf_time_now_t));
|
||||
qof_strftime(qsf_time_string, QSF_DATE_LENGTH, "%F", gmtime(&qsf_time_now_t));
|
||||
qof_strftime(qsf_time_now, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(&qsf_time_now_t));
|
||||
g_hash_table_insert(params->qsf_default_hash, "qsf_enquiry_date", qsf_enquiry_date);
|
||||
g_hash_table_insert(params->qsf_default_hash, "qsf_time_now", &qsf_time_now_t);
|
||||
g_hash_table_insert(params->qsf_default_hash, "qsf_time_string", qsf_time_string);
|
||||
|
@ -52,7 +52,7 @@ qsf_date_default_handler(const gchar *default_name, GHashTable *qsf_default_hash
|
||||
xmlNewProp(output_parent, BAD_CAST QSF_OBJECT_TYPE,
|
||||
xmlGetProp(import_node, BAD_CAST MAP_VALUE_ATTR));
|
||||
qsf_time = (time_t*)g_hash_table_lookup(qsf_default_hash, default_name);
|
||||
strftime(date_as_string, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(qsf_time));
|
||||
qof_strftime(date_as_string, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(qsf_time));
|
||||
xmlNodeAddContent(output_parent, BAD_CAST date_as_string);
|
||||
}
|
||||
|
||||
@ -569,7 +569,7 @@ qsf_set_format_value(xmlChar *format, gchar *qsf_time_now_as_string,
|
||||
regfree(®);
|
||||
/** QSF_DATE_LENGTH preset for all internal and QSF_XSD_TIME string formats.
|
||||
*/
|
||||
strftime(qsf_time_now_as_string, QSF_DATE_LENGTH, (char*)format, gmtime(output));
|
||||
qof_strftime(qsf_time_now_as_string, QSF_DATE_LENGTH, (char*)format, gmtime(output));
|
||||
LEAVE (" ok");
|
||||
}
|
||||
|
||||
|
@ -845,7 +845,7 @@ qof_book_merge_param_as_string(QofParam *qtparam, QofEntity *qtEnt)
|
||||
date_getter = (Timespec (*)(QofEntity*, QofParam*))qtparam->param_getfcn;
|
||||
param_ts = date_getter(qtEnt, qtparam);
|
||||
param_t = timespecToTime_t(param_ts);
|
||||
strftime(param_date, QOF_DATE_STRING_LENGTH, QOF_UTC_DATE_FORMAT, gmtime(¶m_t));
|
||||
qof_strftime(param_date, QOF_DATE_STRING_LENGTH, QOF_UTC_DATE_FORMAT, gmtime(¶m_t));
|
||||
param_string = g_strdup(param_date);
|
||||
return param_string;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ log4glib_handler(const gchar *log_domain,
|
||||
gchar *level_str = qof_log_level_to_string(log_level);
|
||||
now = time(NULL);
|
||||
localtime_r(&now, &now_tm);
|
||||
strftime(timestamp_buf, 9, "%T", &now_tm);
|
||||
qof_strftime(timestamp_buf, 9, "%T", &now_tm);
|
||||
|
||||
fprintf(fout, "* %s %*s <%s> %*s%s%s",
|
||||
timestamp_buf,
|
||||
|
@ -426,7 +426,7 @@ qof_util_param_as_string(QofEntity *ent, QofParam *param)
|
||||
date_getter = (Timespec (*)(QofEntity*, QofParam*))param->param_getfcn;
|
||||
param_ts = date_getter(ent, param);
|
||||
param_t = timespecToTime_t(param_ts);
|
||||
strftime(param_date, MAX_DATE_LENGTH,
|
||||
qof_strftime(param_date, MAX_DATE_LENGTH,
|
||||
QOF_UTC_DATE_FORMAT, gmtime(¶m_t));
|
||||
param_string = g_strdup(param_date);
|
||||
known_type = TRUE;
|
||||
|
@ -531,8 +531,8 @@ timespec_secs_to_given_string (const Timespec *ts, gchar *str)
|
||||
if (!localtime_r(&tmp_time, &parsed_time))
|
||||
return FALSE;
|
||||
|
||||
num_chars = strftime(str, TIMESPEC_SEC_FORMAT_MAX,
|
||||
TIMESPEC_TIME_FORMAT, &parsed_time);
|
||||
num_chars = qof_strftime(str, TIMESPEC_SEC_FORMAT_MAX,
|
||||
TIMESPEC_TIME_FORMAT, &parsed_time);
|
||||
if (num_chars == 0)
|
||||
return FALSE;
|
||||
|
||||
|
@ -562,7 +562,7 @@ static char * get_date_help (VirtualLocation virt_loc, gpointer user_data)
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &ts);
|
||||
tt = ts.tv_sec;
|
||||
tm = localtime (&tt);
|
||||
strftime (string, sizeof(string), "%A %d %B %Y", tm);
|
||||
qof_strftime (string, sizeof(string), "%A %d %B %Y", tm);
|
||||
|
||||
return g_strdup (string);
|
||||
}
|
||||
|
@ -60,9 +60,9 @@ void *parse_env)
|
||||
times_I->tm_yday = amortsched->yday_I;
|
||||
|
||||
printf("\n******************************");
|
||||
strftime(buffer,(size_t)50,"%c",times_E);
|
||||
qof_strftime(buffer,(size_t)50,"%c",times_E);
|
||||
printf("\nEffective Date: %s\n",buffer);
|
||||
strftime(buffer,(size_t)50,"%c",times_I);
|
||||
qof_strftime(buffer,(size_t)50,"%c",times_I);
|
||||
printf("Initial Payment Date: %s\n",buffer);
|
||||
free(times_E);
|
||||
free(times_I);
|
||||
|
@ -65,9 +65,9 @@ FILE *ofile) /* output file */
|
||||
times_I->tm_yday = amortsched->yday_I;
|
||||
|
||||
fprintf(ofile,"Amortization Table\n");
|
||||
strftime(datel,(size_t)100,"%c",times_E);
|
||||
qof_strftime(datel,(size_t)100,"%c",times_E);
|
||||
fprintf(ofile,"Effective Date: %s\n",datel);
|
||||
strftime(datel,(size_t)100,"%c",times_I);
|
||||
qof_strftime(datel,(size_t)100,"%c",times_I);
|
||||
fprintf(ofile,"Initial Payment Date: %s\n",datel);
|
||||
fprintf(ofile,"Compounding Frequency per year: %u\n",amortsched->CF);
|
||||
fprintf(ofile,"Payment Frequency per year: %u\n",amortsched->PF);
|
||||
|
@ -131,7 +131,7 @@ get_wday_name(guint day)
|
||||
struct tm t;
|
||||
memset( &t, 0, sizeof( t ) );
|
||||
t.tm_wday = day;
|
||||
strftime(wday_name, WDAY_NAME_WIDTH, "%A", &t);
|
||||
qof_strftime(wday_name, WDAY_NAME_WIDTH, "%A", &t);
|
||||
return wday_name;
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ get_full_month_name(guint month)
|
||||
static gchar month_name[WDAY_BUF_WIDTH];
|
||||
struct tm t;
|
||||
t.tm_mon = month;
|
||||
strftime(month_name, WDAY_NAME_WIDTH, "%B", &t);
|
||||
qof_strftime(month_name, WDAY_NAME_WIDTH, "%B", &t);
|
||||
return month_name;
|
||||
}
|
||||
#endif
|
||||
@ -154,7 +154,7 @@ get_abbrev_month_name(guint month)
|
||||
struct tm t;
|
||||
memset( &t, 0, sizeof( t ) );
|
||||
t.tm_mon = month;
|
||||
strftime(month_name, WDAY_NAME_WIDTH, "%b", &t);
|
||||
qof_strftime(month_name, WDAY_NAME_WIDTH, "%b", &t);
|
||||
return month_name;
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@ _dow_abbrev(gchar *buf, int buf_len, int dow)
|
||||
memset(buf, 0, buf_len);
|
||||
memset(&my_tm, 0, sizeof(struct tm));
|
||||
my_tm.tm_wday = dow;
|
||||
i = strftime(buf, buf_len - 1, "%a", &my_tm);
|
||||
i = qof_strftime(buf, buf_len - 1, "%a", &my_tm);
|
||||
buf[i] = 0;
|
||||
}
|
||||
|
||||
|
@ -331,9 +331,9 @@ fill_time_popup (GtkWidget *widget, GNCDateEdit *gde)
|
||||
hit = g_new (hour_info_t, 1);
|
||||
|
||||
if (gde->flags & GNC_DATE_EDIT_24_HR)
|
||||
strftime (buffer, sizeof (buffer), "%H:00", mtm);
|
||||
qof_strftime (buffer, sizeof (buffer), "%H:00", mtm);
|
||||
else
|
||||
strftime (buffer, sizeof (buffer), "%I:00 %p ", mtm);
|
||||
qof_strftime (buffer, sizeof (buffer), "%I:00 %p ", mtm);
|
||||
hit->hour = g_strdup (buffer);
|
||||
hit->gde = gde;
|
||||
|
||||
@ -355,11 +355,11 @@ fill_time_popup (GtkWidget *widget, GNCDateEdit *gde)
|
||||
mtm->tm_min = j;
|
||||
hit = g_new (hour_info_t, 1);
|
||||
if (gde->flags & GNC_DATE_EDIT_24_HR)
|
||||
strftime (buffer, sizeof (buffer),
|
||||
"%H:%M", mtm);
|
||||
qof_strftime (buffer, sizeof (buffer),
|
||||
"%H:%M", mtm);
|
||||
else
|
||||
strftime (buffer, sizeof (buffer),
|
||||
"%I:%M %p", mtm);
|
||||
qof_strftime (buffer, sizeof (buffer),
|
||||
"%I:%M %p", mtm);
|
||||
hit->hour = g_strdup (buffer);
|
||||
hit->gde = gde;
|
||||
|
||||
@ -505,9 +505,9 @@ gnc_date_edit_set_time_tm (GNCDateEdit *gde, struct tm *mytm)
|
||||
|
||||
/* Set the time */
|
||||
if (gde->flags & GNC_DATE_EDIT_24_HR)
|
||||
strftime (buffer, sizeof (buffer), "%H:%M", mytm);
|
||||
qof_strftime (buffer, sizeof (buffer), "%H:%M", mytm);
|
||||
else
|
||||
strftime (buffer, sizeof (buffer), "%I:%M %p", mytm);
|
||||
qof_strftime (buffer, sizeof (buffer), "%I:%M %p", mytm);
|
||||
gtk_entry_set_text (GTK_ENTRY (gde->time_entry), buffer);
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ gnc_date_format_refresh (GNCDateFormat *gdf)
|
||||
/* Visual feedback on what the date will look like. */
|
||||
secs_now = time(NULL);
|
||||
localtime_r(&secs_now, &today);
|
||||
strftime(date_string, MAX_DATE_LEN, format, &today);
|
||||
qof_strftime(date_string, MAX_DATE_LEN, format, &today);
|
||||
gtk_label_set_text(GTK_LABEL(priv->sample_label), date_string);
|
||||
g_free(format);
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ static const gchar *day_label(int wday)
|
||||
memset(buf, 0, MONTH_NAME_BUFSIZE);
|
||||
memset(&my_tm, 0, sizeof(struct tm));
|
||||
my_tm.tm_wday = wday;
|
||||
i = strftime (buf, MONTH_NAME_BUFSIZE-1, "%a", &my_tm);
|
||||
i = qof_strftime (buf, MONTH_NAME_BUFSIZE-1, "%a", &my_tm);
|
||||
/* Wild hack to use only the first two letters */
|
||||
buf[2]='\0';
|
||||
return buf;
|
||||
|
@ -415,7 +415,7 @@ TransactionGetTokens(GNCImportTransInfo *info)
|
||||
*/
|
||||
transtime = xaccTransGetDate(transaction);
|
||||
tm_struct = gmtime(&transtime);
|
||||
if(!strftime(local_day_of_week, sizeof(local_day_of_week), "%A", tm_struct))
|
||||
if(!qof_strftime(local_day_of_week, sizeof(local_day_of_week), "%A", tm_struct))
|
||||
{
|
||||
PERR("TransactionGetTokens: error, strftime failed\n");
|
||||
}
|
||||
|
@ -789,7 +789,7 @@ gnc_split_register_get_date_help (VirtualLocation virt_loc,
|
||||
|
||||
tm = localtime (&tt);
|
||||
|
||||
strftime (string, sizeof (string), "%A %d %B %Y", tm);
|
||||
qof_strftime (string, sizeof (string), "%A %d %B %Y", tm);
|
||||
|
||||
return g_strdup (string);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user