Changeset 205f1add in mainline for uspace/lib/posix/include


Ignore:
Timestamp:
2018-08-23T21:14:56Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Children:
f33c989e
Parents:
e2625b1a
git-author:
Jakub Jermar <jakub@…> (2018-08-21 21:58:52)
git-committer:
Jakub Jermar <jakub@…> (2018-08-23 21:14:56)
Message:

Get rid of sys/time.h

This commit moves the POSIX-like time functionality from libc's
sys/time.h to libposix and introduces C99-like or HelenOS-specific
interfaces to libc.

Specifically, use of sys/time.h, struct timeval, suseconds_t and
gettimeofday is replaced by time.h (C99), struct timespec (C99),
usec_t (HelenOS) and getuptime / getrealtime (HelenOS).

Location:
uspace/lib/posix/include/posix
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/include/posix/sys/time.h

    re2625b1a r205f1add  
    3434#define POSIX_SYS_TIME_H_
    3535
    36 #include "libc/sys/time.h"
    37 
    3836#endif
    3937
  • uspace/lib/posix/include/posix/sys/types.h

    re2625b1a r205f1add  
    3838
    3939#include "libc/offset.h"
    40 #include "libc/sys/time.h"
    4140#include "libc/types/common.h"
    4241
     
    5655
    5756/* Clock Types */
    58 typedef long clock_t;
    5957typedef int clockid_t;
    60 
    6158
    6259#endif /* POSIX_SYS_TYPES_H_ */
  • uspace/lib/posix/include/posix/time.h

    re2625b1a r205f1add  
    4141#include <_bits/NULL.h>
    4242
     43#include "libc/time.h"
     44
    4345#ifndef CLOCKS_PER_SEC
    4446#define CLOCKS_PER_SEC (1000000L)
     
    5759#define CLOCK_REALTIME ((clockid_t) 0)
    5860
    59 struct timespec {
    60         time_t tv_sec; /* Seconds. */
    61         long tv_nsec; /* Nanoseconds. */
     61#define DST_NONE  0
     62
     63#define ASCTIME_BUF_LEN  26
     64
     65typedef long suseconds_t;
     66
     67struct timeval {
     68        time_t tv_sec;        /* seconds */
     69        suseconds_t tv_usec;  /* microseconds */
     70};
     71
     72struct timezone {
     73        int tz_minuteswest;  /* minutes W of Greenwich */
     74        int tz_dsttime;      /* type of dst correction */
    6275};
    6376
     
    107120extern clock_t clock(void);
    108121
     122extern int gettimeofday(struct timeval *, struct timezone *);
    109123
    110124#endif  // POSIX_TIME_H_
Note: See TracChangeset for help on using the changeset viewer.