Hi Karl,

On Mon, 2008-10-06 at 11:58 +0100, Karl Lattimer wrote:
> I'm trying to figure out my way around vala's time stuff, but I'm
> having
> a hard time, looking at vapi files isn't great :/
> 
> Specifically I want to produce timestamps, generally this is an easy
> thing to do in most languages but I'm having a syntactical nightmare
> with vala :(

> [...]

> which I'd imagine would work, however I get;
> hellodir.c:38: error: called object ‘time’ is not a function

The reason for this error message is that you can't have a local
variable `time' in C as there is already a function called `time'. valac
could rename the local variable, of course, however, it currently
doesn't recognize the issue before running the C compiler.

> I simply need a unsigned integer out of it, so if someone can post the
> correct usage of atoi if its anything other than int = atoi(string);
> that would be cool too,

If you only need an integer timestamp of the current time, you can cast
a time_t value, e.g.

        long t = (long) time_t ();

In Vala trunk I've marked time_t as an integer type compatible to long,
so the cast is not necessary anymore.

Regards,
Jürg

_______________________________________________
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to