Skip to content

Commit ffe72e9

Browse files
committed
auto merge of #12940 : cadencemarseille/rust/time-doc, r=alexcrichton
2 parents 4e1172e + 5bb9bd2 commit ffe72e9

File tree

1 file changed

+43
-12
lines changed

1 file changed

+43
-12
lines changed

src/libtime/lib.rs

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,51 @@ pub fn tzset() {
187187
}
188188
}
189189

190+
/// Holds a calendar date and time broken down into its components (year, month, day, and so on),
191+
/// also called a broken-down time value.
190192
#[deriving(Clone, Eq, Encodable, Decodable, Show)]
191193
pub struct Tm {
192-
tm_sec: i32, // seconds after the minute ~[0-60]
193-
tm_min: i32, // minutes after the hour ~[0-59]
194-
tm_hour: i32, // hours after midnight ~[0-23]
195-
tm_mday: i32, // days of the month ~[1-31]
196-
tm_mon: i32, // months since January ~[0-11]
197-
tm_year: i32, // years since 1900
198-
tm_wday: i32, // days since Sunday ~[0-6]
199-
tm_yday: i32, // days since January 1 ~[0-365]
200-
tm_isdst: i32, // Daylight Savings Time flag
201-
tm_gmtoff: i32, // offset from UTC in seconds
202-
tm_zone: ~str, // timezone abbreviation
203-
tm_nsec: i32, // nanoseconds
194+
/// Seconds after the minute – [0, 60]
195+
tm_sec: i32,
196+
197+
/// Minutes after the hour – [0, 59]
198+
tm_min: i32,
199+
200+
/// Hours after midnight – [0, 23]
201+
tm_hour: i32,
202+
203+
/// Day of the month – [1, 31]
204+
tm_mday: i32,
205+
206+
/// Months since January – [0, 11]
207+
tm_mon: i32,
208+
209+
/// Years since 1900
210+
tm_year: i32,
211+
212+
/// Days since Sunday – [0, 6]. 0 = Sunday, 1 = Monday, …, 6 = Saturday.
213+
tm_wday: i32,
214+
215+
/// Days since January 1 – [0, 365]
216+
tm_yday: i32,
217+
218+
/// Daylight Saving Time flag.
219+
///
220+
/// This value is positive if Daylight Saving Time is in effect, zero if Daylight Saving Time
221+
/// is not in effect, and negative if this information is not available.
222+
tm_isdst: i32,
223+
224+
/// Identifies the time zone that was used to compute this broken-down time value, including any
225+
/// adjustment for Daylight Saving Time. This is the number of seconds east of UTC. For example,
226+
/// for U.S. Pacific Daylight Time, the value is -7*60*60 = -25200.
227+
tm_gmtoff: i32,
228+
229+
/// Abbreviated name for the time zone that was used to compute this broken-down time value.
230+
/// For example, U.S. Pacific Daylight Time is "PDT".
231+
tm_zone: ~str,
232+
233+
/// Nanoseconds after the second – [0, 10<sup>9</sup> - 1]
234+
tm_nsec: i32,
204235
}
205236

206237
pub fn empty_tm() -> Tm {

0 commit comments

Comments
 (0)