[Vala] The right way to compare file timestamp?




I want to compare the timestamp of a given file, to see whether
a modification warning shell be given.
I try to use this code as a start(with GIO package):
if (file.query_exists ()) {
    FileInfo info = file.query_filesystem_info ("*");
    TimeVal temp_time;
    info.get_modification_time (out temp_time);
    stdout.printf ("Current timestamp: " + temp_time.to_iso8601 () + "\n");
}

On the console, I get:
Current timestamp: 1970-01-01T00:00:00Z

It always stay the same no matter what I do to the file.
What is wrong with my code?

And another question- Can I convert this TimeVal into int64?
It will be easier to compare this way. It also said that GLib will
drop TimeVal for int64 in future on docs.
                                          


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