Time on marquee doesn't sync with time on moblin-applets when changing timezone

Bug #208167 reported by cathyli
4
Affects Status Importance Assigned to Milestone
Moblin Applets
Fix Released
High
ToddBrandt

Bug Description

Description:
-------------
Time on marquee doesn't sync with time on moblin-applets when changing timezone. Found the issue in applets 0.50.1

Reproduced steps:
-------------
1. Launch date/time applet.
2. Change timezone such as Asia/Shanghai, default timezone filed is empty.

Current results:
-------------
after change timezone, time show on applets is different on marquee bar. Pls. see attachment.

Expected results:
-------------
In step2, time show on applets should be same with marquee bar.

Revision history for this message
cathyli (cathy-li) wrote :
Revision history for this message
cathyli (cathy-li) wrote :

Todd, hope the issue can be fixed in m10. Add "pending" tag temporarily.

Changed in moblin-applets:
assignee: nobody → todd-e-brandt
importance: Undecided → High
Revision history for this message
ToddBrandt (todd-e-brandt) wrote :

Actually I'm not sure this is a bug but rather a confusing default setting of the time applet. the time applet always shows UTC time where the marquee shows local time (adjusted for the time zone). Should I relabel the "Time" field in the applet dialog to say "UTC Time"?

Changed in moblin-applets:
status: New → Confirmed
Revision history for this message
Bob Spencer (bob-spencer) wrote :

Here's the code for changing time:

static gboolean clock_plugin_update_time (gpointer data)
{
  ClockPlugin *clock_plugin = (ClockPlugin *)data;
  ClockPluginPrivate *priv = CLOCK_PLUGIN_GET_PRIVATE (clock_plugin);
  struct timeval time_val;
  struct tm *tm_time;
  gchar *tz_str;
  gchar time_str[60];

  //reset timezone
  tz_str = g_strdup (g_getenv ("TZ"));
  g_unsetenv ("TZ");
  if (tz_str)
  {
    g_setenv ("TZ", tz_str, FALSE);
    g_free (tz_str);
  }
  gettimeofday (&time_val, NULL);
  tm_time = localtime (&time_val.tv_sec);
  strftime (time_str, G_N_ELEMENTS (time_str), priv->time_format, tm_time);

Changed in moblin-applets:
milestone: none → m10
Revision history for this message
ToddBrandt (todd-e-brandt) wrote :

Fixed in 0.51, I added a read of the utc time before the timezone change, and a write of that utc time after the timezone change. The time now jumps before or ahead by the difference in timezone hours just like the marquee clock applet.

Changed in moblin-applets:
status: Confirmed → Fix Committed
Revision history for this message
cathyli (cathy-li) wrote :

Verified in applets 0.52, the issue is fixed, close it.

Changed in moblin-applets:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.