Changeset 6119f24 in mainline for uspace/lib/c/generic/time.c
- Timestamp:
- 2011-01-29T18:58:24Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 10477601, 6aef742
- Parents:
- d7533c7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/time.c
rd7533c7 r6119f24 34 34 35 35 #include <sys/time.h> 36 #include < unistd.h>36 #include <time.h> 37 37 #include <bool.h> 38 #include <ipc/ns.h>39 38 #include <arch/barrier.h> 40 39 #include <macros.h> 40 #include <errno.h> 41 #include <sysinfo.h> 42 #include <as.h> 43 #include <ddi.h> 41 44 #include <libc.h> 42 #include <time.h>43 45 44 46 /** Pointer to kernel shared variables with time */ … … 137 139 int gettimeofday(struct timeval *tv, struct timezone *tz) 138 140 { 139 if (!ktime) { 140 ktime = service_realtime_share_in(); 141 if (!ktime) 141 if (ktime == NULL) { 142 uintptr_t faddr; 143 int rc = sysinfo_get_value("clock.faddr", &faddr); 144 if (rc != EOK) { 145 errno = rc; 142 146 return -1; 147 } 148 149 void *addr = as_get_mappable_page(PAGE_SIZE); 150 if (addr == NULL) { 151 errno = ENOMEM; 152 return -1; 153 } 154 155 rc = physmem_map((void *) faddr, addr, 1, 156 AS_AREA_READ | AS_AREA_CACHEABLE); 157 if (rc != EOK) { 158 as_area_destroy(addr); 159 errno = rc; 160 return -1; 161 } 162 163 ktime = addr; 143 164 } 144 165
Note:
See TracChangeset
for help on using the changeset viewer.