aboutsummaryrefslogtreecommitdiff
path: root/src/datetime-service.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-08-17 14:56:03 -0500
committerTed Gould <ted@gould.cx>2011-08-17 14:56:03 -0500
commit09f6c57c2441719f1d9d86ac629f970a7f95bfb5 (patch)
tree04bfa33a53145c64a9e999e3b9d319fc1486f5e0 /src/datetime-service.c
parentd6387351865a03d04d2d5881a59dd2652bc3947a (diff)
parentac74e3a3a1600fd57d23a7d8a5bf1be674a5b2d9 (diff)
downloadayatana-indicator-datetime-09f6c57c2441719f1d9d86ac629f970a7f95bfb5.tar.gz
ayatana-indicator-datetime-09f6c57c2441719f1d9d86ac629f970a7f95bfb5.tar.bz2
ayatana-indicator-datetime-09f6c57c2441719f1d9d86ac629f970a7f95bfb5.zip
Use cleaner gdatetime
Diffstat (limited to 'src/datetime-service.c')
-rw-r--r--src/datetime-service.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index c1f1eb6..e46b04d 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -299,25 +299,25 @@ quick_set_tz (DbusmenuMenuitem * menuitem, guint timestamp, gpointer user_data)
static gboolean
update_datetime (gpointer user_data)
{
- g_debug("Updating Date/Time");
+ GDateTime *datetime;
+ gchar *utf8;
- gchar longstr[128];
- time_t t;
- struct tm *ltime;
+ g_debug("Updating Date/Time");
- t = time(NULL);
- ltime = localtime(&t);
- if (ltime == NULL) {
+ datetime = g_date_time_new_now_local ();
+ if (datetime == NULL) {
g_warning("Error getting local time");
dbusmenu_menuitem_property_set(date, DBUSMENU_MENUITEM_PROP_LABEL, _("Error getting time"));
+ g_date_time_unref (datetime);
return FALSE;
}
- /* Translators: strftime(3) style date format on top of the menu when you click on the clock */
- strftime(longstr, 128, _("%A, %e %B %Y"), ltime);
-
- gchar * utf8 = g_locale_to_utf8(longstr, -1, NULL, NULL, NULL);
+ /* eranslators: strftime(3) style date format on top of the menu when you click on the clock */
+ utf8 = g_date_time_format (datetime, _("%A, %e %B %Y"));
+
dbusmenu_menuitem_property_set(date, DBUSMENU_MENUITEM_PROP_LABEL, utf8);
+
+ g_date_time_unref (datetime);
g_free(utf8);
return FALSE;
@@ -701,7 +701,7 @@ update_appointment_menu_items (gpointer user_data)
// Get today & work out query times
time(&curtime);
- struct tm *today = localtime(&curtime);
+ struct tm *today = localtime(&curtime);
const int mday = today->tm_mday;
const int mon = today->tm_mon;
const int year = today->tm_year;