File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
components/libc/compilers/common Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -174,23 +174,24 @@ double difftime (time_t tim1, time_t tim2)
174174 *
175175 * @param time_t * t the timestamp pointer, if not used, keep NULL.
176176 *
177- * @return time_t return timestamp current.
177+ * @return The value ((time_t)-1) is returned if the calendar time is not available.
178+ * If timer is not a NULL pointer, the return value is also stored in timer.
178179 *
179180 */
180181RT_WEAK time_t time (time_t * t )
181182{
182- time_t time_now = 0 ;
183+ time_t time_now = (( time_t ) - 1 ); /* default is not available */
183184
184185#ifdef RT_USING_RTC
185186 static rt_device_t device = RT_NULL ;
186187
187- /* optimization: find rtc device only first. */
188+ /* optimization: find rtc device only first */
188189 if (device == RT_NULL )
189190 {
190191 device = rt_device_find ("rtc" );
191192 }
192193
193- /* read timestamp from RTC device. */
194+ /* read timestamp from RTC device */
194195 if (device != RT_NULL )
195196 {
196197 if (rt_device_open (device , 0 ) == RT_EOK )
You can’t perform that action at this time.
0 commit comments