libc: Add difftime()
This commit is contained in:
parent
2980ee3973
commit
04ae97a6ec
@ -77,6 +77,9 @@ extern "C"
|
||||
/* Fills str with a formatted string representation of time according to the format string. */
|
||||
size_t strftime(char* str, size_t max, const char* format, const struct tm* time);
|
||||
|
||||
/* Returns the difference between two times. */
|
||||
double difftime(time_t time2, time_t time1);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -175,4 +175,9 @@ extern "C"
|
||||
{
|
||||
return broken_down_to_unix(time->tm_year, time->tm_yday, time->tm_hour, time->tm_min, time->tm_sec);
|
||||
}
|
||||
|
||||
double difftime(time_t time2, time_t time1)
|
||||
{
|
||||
return (double)(time2 - time1);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user