Re: [Vala] The right way to compare file timestamp?




OK, I got this fixed.
Just switch
FileInfo info = file.query_filesystem_info ("*");
with
FileInfo info = file.query_info ("standard::content-type,time::modified", 0, null);
Thanks to cheese source code.
Tal

From: tal_hd hotmail com
To: vala-list gnome org
Date: Sun, 16 Oct 2011 16:22:42 +0200
Subject: [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.
                                          

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


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