[Vala] Using uninitialized Glib.TimeVal



Hi.

I'm trying to use Glib.TimeVal with its from_iso8601() initializer, but
I can't get the generated C code not to contain a call to
g_get_current_time() first. At first, I tried this Vala code:

string iso8601_date = "1999-05-31T11:20:00";
TimeVal time_val;
time_val.from_iso8601(iso8601_date);

but that makes the compiler complain:

error: use of possibly unassigned local variable `time_val'

So then I tried this code:

string iso8601_date = "1999-05-31T11:20:00";
TimeVal time_val = TimeVal();
time_val.from_iso8601(iso8601_date);

but that makes the compiler output the following code:

g_get_current_time (&time_val);
g_time_val_from_iso8601 (iso8601_date, &time_val);

What do I do to make it not call g_get_current_time()? I know it's
probably minimal, but it's still wasted CPU cycles and extraneous code
to compile and whatnot, and I want the option to leave it out if at all
possible. If it isn't possible, a way to make it possible should be
considered to be implemented.

Regards,
Alexander K. Schrøder

Attachment: signature.asc
Description: OpenPGP digital signature



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