Mercurial > projects > dil
diff trunk/src/dil/Time.d @ 798:c24be8d4f6ab
Added documentation comments.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sat, 01 Mar 2008 02:53:06 +0100 |
parents | 580d4ca9f1ff |
children |
line wrap: on
line diff
--- a/trunk/src/dil/Time.d Fri Feb 29 22:51:24 2008 +0100 +++ b/trunk/src/dil/Time.d Sat Mar 01 02:53:06 2008 +0100 @@ -7,9 +7,11 @@ import tango.stdc.time : time_t, time, ctime; import tango.stdc.string : strlen; +/// Some convenience functions for dealing with C's time functions. struct Time { static: + /// Returns the current date as a string. char[] toString() { time_t time_val; @@ -19,16 +21,19 @@ return timeStr.dup; } + /// Returns the time of timeStr: hh:mm:ss char[] time(char[] timeStr) { return timeStr[11..19]; } + /// Returns the month and day of timeStr: Mmm dd char[] month_day(char[] timeStr) { return timeStr[4..10]; } + /// Returns the year of timeStr: yyyy char[] year(char[] timeStr) { return timeStr[20..24];