[gnome-control-center] printers: Show correct time of print job



commit 69fc7e9fdc983c2029e23310c980abb321185af6
Author: Marek Kasik <mkasik redhat com>
Date:   Wed Jan 15 16:55:20 2014 +0100

    printers: Show correct time of print job
    
    g_date_time_new_local() expects month in range 1..12
    but localtime() returns month in range 0..11.
    g_date_time_new_local() also expects absolute value
    for year but localtime() returns number of years since 1900.
    
    Adding 1 to month and 1900 to year fixes this.

 panels/printers/pp-jobs-dialog.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/panels/printers/pp-jobs-dialog.c b/panels/printers/pp-jobs-dialog.c
index b9f291c..079d8e4 100644
--- a/panels/printers/pp-jobs-dialog.c
+++ b/panels/printers/pp-jobs-dialog.c
@@ -119,8 +119,8 @@ update_jobs_list_cb (cups_job_t *jobs,
       gchar     *state = NULL;
 
       ts = localtime (&(dialog->jobs[i].creation_time));
-      time = g_date_time_new_local (ts->tm_year,
-                                    ts->tm_mon,
+      time = g_date_time_new_local (ts->tm_year + 1900,
+                                    ts->tm_mon + 1,
                                     ts->tm_mday,
                                     ts->tm_hour,
                                     ts->tm_min,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]