the time of now for the age of recent items, Today and Yesterday in the file chooser, the day of the calendar and the CUPS print time also after 2038 where time_t has 32 bits, from clock_gettime64 on Linux
This commit is contained in:
parent
abea33b3ee
commit
abb3c12457
4 changed files with 10 additions and 6 deletions
|
|
@ -54,6 +54,7 @@
|
|||
#include "gtkmarshalers.h"
|
||||
#include "gtktooltip.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtktimeprivate.h"
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
|
|
@ -766,7 +767,7 @@ gtk_calendar_init (GtkCalendar *calendar)
|
|||
}
|
||||
|
||||
/* Set defaults */
|
||||
now_dt = g_date_time_new_now_local ();
|
||||
now_dt = _gtk_date_time_new_now_local ();
|
||||
if (now_dt)
|
||||
{
|
||||
calendar->month = g_date_time_get_month (now_dt) - 1;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@
|
|||
#include "gtkmountoperation.h"
|
||||
#include "gtkpathbar.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtktimeprivate.h"
|
||||
#include "gtkradiobutton.h"
|
||||
#include "gtkrecentfilter.h"
|
||||
#include "gtkrecentmanager.h"
|
||||
|
|
@ -6365,7 +6366,7 @@ file_list_update_fixed_sizing (GtkFileChooserDefault *impl)
|
|||
/* Date column: today, yesterday, every weekday and one date per month,
|
||||
* formatted exactly like the column does. */
|
||||
texts = g_ptr_array_new_with_free_func (g_free);
|
||||
now = g_date_time_new_now_local ();
|
||||
now = _gtk_date_time_new_now_local ();
|
||||
now_secs = g_date_time_to_unix (now);
|
||||
for (i = 0; i < 7; i++)
|
||||
g_ptr_array_add (texts, my_g_format_time_for_display (now_secs - i * 24 * 3600));
|
||||
|
|
@ -9632,7 +9633,7 @@ my_g_format_time_for_display (gint64 secs)
|
|||
(GDateMonth) g_date_time_get_month (mtime_dt),
|
||||
g_date_time_get_year (mtime_dt));
|
||||
|
||||
now_dt = g_date_time_new_now_local ();
|
||||
now_dt = _gtk_date_time_new_now_local ();
|
||||
if (now_dt == NULL)
|
||||
{
|
||||
g_date_time_unref (mtime_dt);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "gtkicontheme.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtktimeprivate.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
|
|
@ -1749,7 +1750,7 @@ gtk_recent_manager_clamp_to_age (GtkRecentManager *manager,
|
|||
return;
|
||||
|
||||
/* not time (), which a 32-bit time_t cannot give after 2038 */
|
||||
now = g_get_real_time () / G_USEC_PER_SEC;
|
||||
now = _gtk_get_real_time () / G_USEC_PER_SEC;
|
||||
|
||||
uris = g_bookmark_file_get_uris (priv->recent_items, &n_uris);
|
||||
|
||||
|
|
@ -2663,7 +2664,7 @@ gtk_recent_info_get_age (GtkRecentInfo *info)
|
|||
|
||||
g_return_val_if_fail (info != NULL, -1);
|
||||
|
||||
now = g_get_real_time () / G_USEC_PER_SEC;
|
||||
now = _gtk_get_real_time () / G_USEC_PER_SEC;
|
||||
|
||||
if (!recent_time_get_days_elapsed (now, info->modified, &retval))
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
#include <gtk/gtkprintbackend.h>
|
||||
#include <gtk/gtkunixprint.h>
|
||||
#include <gtk/gtkprinter-private.h>
|
||||
#include <gtk/gtktimeprivate.h>
|
||||
|
||||
#include "gtkprintbackendcups.h"
|
||||
#include "gtkprintercups.h"
|
||||
|
|
@ -5909,7 +5910,7 @@ localtime_to_utctime (const char *local_time)
|
|||
|
||||
/* The offset of local time now, from GDateTime: time () has no
|
||||
* answer after 2038 where time_t is 32 bits */
|
||||
now = g_date_time_new_now_local ();
|
||||
now = _gtk_date_time_new_now_local ();
|
||||
if (now == NULL)
|
||||
return NULL;
|
||||
offset = g_date_time_get_utc_offset (now) / G_USEC_PER_SEC;
|
||||
|
|
|
|||
Loading…
Reference in a new issue