Changeset 813a703 in mainline for uspace/lib/libc/generic/time.c


Ignore:
Timestamp:
2007-10-03T06:37:02Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
40676a2
Parents:
4d61252
Message:

Support for time() function.

File:
1 edited

Legend:

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

    r4d61252 r813a703  
    149149                        _exit(1);
    150150                }
    151                 if (! (rights & AS_AREA_READ)) {
     151                if (!(rights & AS_AREA_READ)) {
    152152                        printf("Received bad rights on time area: %X\n",
    153                                rights);
     153                            rights);
    154154                        as_area_destroy(mapping);
    155155                        _exit(1);
     
    176176}
    177177
     178time_t time(time_t *tloc)
     179{
     180        struct timeval tv;
     181
     182        if (gettimeofday(&tv, NULL))
     183                return (time_t) -1;
     184        if (tloc)
     185                *tloc = tv.tv_sec;
     186        return tv.tv_sec;
     187}
     188
    178189/** Wait unconditionally for specified number of microseconds */
    179190void usleep(unsigned long usec)
Note: See TracChangeset for help on using the changeset viewer.