@@ -136,6 +136,86 @@ impl Duration {
136136 #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
137137 pub const NANOSECOND : Duration = Duration :: from_nanos ( 1 ) ;
138138
139+ /// The duration of one week.
140+ ///
141+ /// For this constant, one week is defined as 7 days, or 604,800 seconds.
142+ ///
143+ /// # Examples
144+ ///
145+ /// ```
146+ /// #![feature(duration_constants)]
147+ /// #![feature(duration_constructors)]
148+ /// use std::time::Duration;
149+ ///
150+ /// let week = Duration::WEEK;
151+ ///
152+ /// assert_eq!(week, Duration::from_weeks(1));
153+ /// assert_eq!(week.as_secs(), 604_800);
154+ /// assert_eq!(week.subsec_nanos(), 0);
155+ /// ```
156+ #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
157+ // Also, #[unstable(feature = "duration_constructors", issue = "120301")]
158+ pub const WEEK : Duration = Duration :: from_weeks ( 1 ) ;
159+
160+ /// The duration of one day.
161+ ///
162+ /// For this constant, one day is defined as 24 hours, or 86,400 seconds.
163+ ///
164+ /// # Examples
165+ ///
166+ /// ```
167+ /// #![feature(duration_constants)]
168+ /// #![feature(duration_constructors)]
169+ /// use std::time::Duration;
170+ ///
171+ /// let day = Duration::DAY;
172+ ///
173+ /// assert_eq!(day, Duration::from_days(1));
174+ /// assert_eq!(day.as_secs(), 86400);
175+ /// assert_eq!(day.subsec_nanos(), 0);
176+ /// ```
177+ #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
178+ // Also, #[unstable(feature = "duration_constructors", issue = "120301")]
179+ pub const DAY : Duration = Duration :: from_days ( 1 ) ;
180+
181+ /// The duration of one hour.
182+ ///
183+ /// For this constant, one hour is defined as 60 minutes, or 3,600 seconds.
184+ ///
185+ /// # Examples
186+ ///
187+ /// ```
188+ /// #![feature(duration_constants)]
189+ /// use std::time::Duration;
190+ ///
191+ /// let hour = Duration::HOUR;
192+ ///
193+ /// assert_eq!(hour, Duration::from_hours(1));
194+ /// assert_eq!(hour.as_secs(), 3600);
195+ /// assert_eq!(hour.subsec_nanos(), 0);
196+ /// ```
197+ #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
198+ pub const HOUR : Duration = Duration :: from_hours ( 1 ) ;
199+
200+ /// The duration of one minute.
201+ ///
202+ /// For this constant, one minute is defined as 60 seconds.
203+ ///
204+ /// # Examples
205+ ///
206+ /// ```
207+ /// #![feature(duration_constants)]
208+ /// use std::time::Duration;
209+ ///
210+ /// let minute = Duration::MINUTE;
211+ ///
212+ /// assert_eq!(minute, Duration::from_mins(1));
213+ /// assert_eq!(minute.as_secs(), 60);
214+ /// assert_eq!(minute.subsec_nanos(), 0);
215+ /// ```
216+ #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
217+ pub const MINUTE : Duration = Duration :: from_mins ( 1 ) ;
218+
139219 /// A duration of zero time.
140220 ///
141221 /// # Examples
0 commit comments