]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Improve Time.to_string method and add Time.format method
authorJürg Billeter <j@bitron.ch>
Mon, 8 Dec 2008 23:21:23 +0000 (23:21 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Mon, 8 Dec 2008 23:21:23 +0000 (23:21 +0000)
2008-12-09  Jürg Billeter  <j@bitron.ch>

* vapi/glib-2.0.vapi:

Improve Time.to_string method and add Time.format method

svn path=/trunk/; revision=2125

ChangeLog
vapi/glib-2.0.vapi

index 9b640f91b35bf1767cc567d00dd1d6427724ee45..8fd8675c336d39fd90893b0a2ae1619bfd67a437 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-09  Jürg Billeter  <j@bitron.ch>
+
+       * vapi/glib-2.0.vapi:
+
+       Improve Time.to_string method and add Time.format method
+
 2008-12-09  Jürg Billeter  <j@bitron.ch>
 
        * gobject/valaccodemethodmodule.vala:
index 3dedc44a6ea5e0cc6854150f8965e1a792514b79..ab7aae11b0f7b073eda69e4309d71d52984f095e 100644 (file)
@@ -1697,13 +1697,20 @@ namespace GLib {
                [CCode (cname = "localtime_r", instance_pos = -1)]
                public Time.local (time_t time);
 
-               [CCode (cname = "asctime_r")]
-               public string to_string (char* buffer = new char[26]);
+               public string to_string () {
+                       return "%04d-%02d-%02d %02d:%02d:%02d".printf (year + 1900, month + 1, day, hour, minute, second);
+               }
+
+               public string format (string format) {
+                       var buffer = new char[64];
+                       this.strftime (buffer, format);
+                       return (string) buffer;
+               }
 
                [CCode (cname = "mktime")]
                public time_t mktime ();
 
-               [CCode (instance_pos = -1)]
+               [CCode (cname = "strftime", instance_pos = -1)]
                public size_t strftime (char[] s, string format);
                [CCode (instance_pos = -1)]
                public weak string? strptime (string buf, string format);