Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset d3e3a71 in mainline


Ignore:
Timestamp:
2012-04-23T22:35:15Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
3293a94
Parents:
56b308e
Message:

libc: move difftime() from libposix to libc

Location:
uspace/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/time.c

    r56b308e rd3e3a71  
    876876}
    877877
     878/**
     879 * Calculate the difference between two times, in seconds.
     880 *
     881 * @param time1 First time.
     882 * @param time0 Second time.
     883 * @return Time in seconds.
     884 */
     885double difftime(time_t time1, time_t time0)
     886{
     887        return (double) (time1 - time0);
     888}
     889
    878890/** @}
    879891 */
  • uspace/lib/c/include/sys/time.h

    r56b308e rd3e3a71  
    8484extern struct tm *localtime(const time_t *timer);
    8585extern char *ctime(const time_t *timer);
     86extern double difftime(time_t time1, time_t time0);
    8687extern size_t strftime(char *restrict s, size_t maxsize,
    8788    const char *restrict format, const struct tm *restrict tm);
  • uspace/lib/posix/time.c

    r56b308e rd3e3a71  
    311311
    312312/**
    313  * Calculate the difference between two times, in seconds.
    314  *
    315  * @param time1 First time.
    316  * @param time0 Second time.
    317  * @return Time in seconds.
    318  */
    319 double posix_difftime(time_t time1, time_t time0)
    320 {
    321         return (double) (time1 - time0);
    322 }
    323 
    324 /**
    325313 * Converts a time value to a broken-down UTC time.
    326314 *
  • uspace/lib/posix/time.h

    r56b308e rd3e3a71  
    8484extern void posix_tzset(void);
    8585
    86 /* Elapsed Time */
    87 extern double posix_difftime(time_t time1, time_t time0);
    88 
    8986/* Broken-down Time */
    9087extern struct tm *posix_gmtime_r(const time_t *restrict timer,
     
    121118        #define tzset posix_tzset
    122119
    123         #define difftime posix_difftime
    124 
    125120        #define gmtime_r posix_gmtime_r
    126121        #define localtime_r posix_localtime_r
Note: See TracChangeset for help on using the changeset viewer.