I am using glibs functions to convert epoch time to string as follows.
But each time it is giving me some random time.
//Convert Time in string.
GDate *date = g_date_new_julian(timestampsecs);
gchar date_string[50];
g_date_strftime(date_string, 50, (const gchar*)"%a, %I:%M %p", (const GDate*)date);
printf("Date String [%s]\n", date_string );
Why this might be happening? am i missing anything?
Thanks,
PP.
UPDATE:
As said i tried with setlocale(LC_ALL, "");
following is the output,
It is the same as i was getting before using setlocale
.
(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279703 computed dmy: 66 4293563716 187
Date String Tik_INDEX[1] [1272279703] --> [Tue, 12:00 AM]
(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279717 computed dmy: 80 4293563716 187
Date String Tik_INDEX[2] [1272279717] --> [Tue, 12:00 AM]
(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279720 computed dmy: 53 4293563717 187
Date String Tik_INDEX[3] [1272279720] --> [Fri, 12:00 AM]
(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279721 computed dmy: 54 4293563717 187
Date String Tik_INDEX[4] [1272279721] --> [Sat, 12:00 AM]
(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279721 computed dmy: 54 4293563717 187
Date String Tik_INDEX[5] [1272279721] --> [Sat, 12:00 AM]
(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279722 computed dmy: 55 4293563717 187
Date String Tik_INDEX[6] [1272279722] --> [Sun, 12:00 AM]
(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279723 computed dmy: 56 4293563717 187
Date String Tik_INDEX[7] [1272279723] --> [Mon, 12:00 AM]
(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279724 computed dmy: 57 4293563717 187
Date String Tik_INDEX[8] [1272279724] --> [Tue, 12:00 AM]