On Wed, 7 Dec 2005 20:47:32 +0000
Felix Kater <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> to sum up:
> 
> With g_get_current_time() / win32 it seems that I get UTC instead of
> the local time. How can I get the local time?
> 
> Long version:
> 
> I use g_get_current_time() / win32 to set GTimeVal and calculate the
> current hour of the
> day (0-23) like this:
> 
> hour_of_the_day=
>  my_gtimeval.tv_sec % (3600*24) / 3600
> 
> 
> My windows timezone is set to UTC+1 == GMT+1 == CET, however, this is
> not respected. What ever I select as the windows timezone the above
> formula calculates the same wrong hour (it seems to be UTC always).
> 
> 
> How can I get the local time?

did you try with
  time_t t;
  struct tm *lt;

  t = time (NULL);
  lt = localtime (&t);
  sprintf (current_time_ret, "%04d-%02d-%02d %02d:%02d:%02d",
           lt->tm_year+1900, lt->tm_mon+1, lt->tm_mday,
           lt->tm_hour, lt->tm_min, lt->tm_sec);

it works on windows and linux.


-- 
HuamiSoft Hubert Sokolowski
http://www.huamisoft.com/
tel. 501456743
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to