[gnome-color-manager] Use strftime rather than our own hand-rolled function
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Use strftime rather than our own hand-rolled function
- Date: Sat, 12 Dec 2009 09:20:33 +0000 (UTC)
commit 6607487433a1bf074638d6833bd7c493ef1d75ff
Author: Richard Hughes <richard hughsie com>
Date: Sat Dec 12 09:19:57 2009 +0000
Use strftime rather than our own hand-rolled function
src/gcm-profile.c | 2 +-
src/gcm-utils.c | 70 ++++-------------------------------------------------
src/gcm-utils.h | 7 +----
3 files changed, 7 insertions(+), 72 deletions(-)
---
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index a6abf96..0abfb35 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -718,7 +718,7 @@ gcm_profile_parse_data (GcmProfile *profile, const guint8 *data, gsize length, G
/* get the profile created time and date */
ret = cmsTakeCreationDateTime (&created, priv->lcms_profile);
if (ret)
- priv->datetime = gcm_utils_format_date_time (1900+created.tm_year, created.tm_mon+1, created.tm_mday, created.tm_hour, created.tm_min, created.tm_sec);
+ priv->datetime = gcm_utils_format_date_time (&created);
/* get the number of tags in the file */
num_tags = gcm_parser_decode_32 (data + GCM_NUMTAGS);
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index 203466c..76e5b24 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -649,78 +649,18 @@ gcm_utils_device_type_to_profile_type (GcmDeviceType type)
return profile_type;
}
-
-/**
- * gcm_utils_month_to_localized_text:
- **/
-static const gchar *
-gcm_utils_month_to_localized_text (guint idx)
-{
- if (idx == 1) {
- /* TRANSLATORS: the month */
- return _("January");
- }
- if (idx == 2) {
- /* TRANSLATORS: the month */
- return _("February");
- }
- if (idx == 3) {
- /* TRANSLATORS: the month */
- return _("March");
- }
- if (idx == 4) {
- /* TRANSLATORS: the month */
- return _("April");
- }
- if (idx == 5) {
- /* TRANSLATORS: the month */
- return _("May");
- }
- if (idx == 6) {
- /* TRANSLATORS: the month */
- return _("June");
- }
- if (idx == 7) {
- /* TRANSLATORS: the month */
- return _("July");
- }
- if (idx == 8) {
- /* TRANSLATORS: the month */
- return _("August");
- }
- if (idx == 9) {
- /* TRANSLATORS: the month (my birthday) */
- return _("September");
- }
- if (idx == 10) {
- /* TRANSLATORS: the month */
- return _("October");
- }
- if (idx == 11) {
- /* TRANSLATORS: the month */
- return _("November");
- }
- if (idx == 12) {
- /* TRANSLATORS: the month */
- return _("December");
- }
- return NULL;
-}
-
/**
* gcm_utils_format_date_time:
**/
gchar *
-gcm_utils_format_date_time (guint years, guint months, guint days,
- guint hours, guint minutes, guint seconds)
+gcm_utils_format_date_time (const struct tm *created)
{
- const gchar *month_text;
+ gchar buffer[256];
- /* write the month as a word to avoid locale confusion */
- month_text = gcm_utils_month_to_localized_text (months);
+ /* TRANSLATORS: this is the profile creation date strftime format */
+ strftime (buffer, sizeof(buffer), _("%e %B %Y, %H:%M:%S"), created);
- /* TRANSLATORS: please re-arrange: days, months (in text), years, hours, minutes, seconds */
- return g_strdup_printf (_("%i %s %04i, %02i:%02i:%02i"), days, month_text, years, hours, minutes, seconds);
+ return g_strdup (g_strchug (buffer));
}
/***************************************************************************
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index bc3ad9d..a570d6b 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -51,12 +51,7 @@ void gcm_utils_alphanum_lcase (gchar *string);
void gcm_utils_ensure_sensible_filename (gchar *string);
gchar *gcm_utils_get_default_config_location (void);
GcmProfileType gcm_utils_device_type_to_profile_type (GcmDeviceType type);
-gchar *gcm_utils_format_date_time (guint years,
- guint months,
- guint days,
- guint hours,
- guint minutes,
- guint seconds);
+gchar *gcm_utils_format_date_time (const struct tm *created);
#endif /* __GCM_UTILS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]