Changeset 5065:18cdc8c3a1ab in roaraudio for libroar/time.c
- Timestamp:
- 06/18/11 04:07:49 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/time.c
r5031 r5065 57 57 58 58 if ( time->c_drift == 0 ) { 59 mes->datalen -= 4;59 mes->datalen -= 8; 60 60 if ( time->c_freq == 0 ) { 61 mes->datalen -= 4;61 mes->datalen -= 8; 62 62 if ( time->t_ssec == 0 ) { 63 mes->datalen -= 4;63 mes->datalen -= 8; 64 64 } 65 65 } … … 140 140 } 141 141 142 int roar_clock_gettime(struct roar_time * rt, int clock) { 143 #ifdef ROAR_HAVE_GETTIMEOFDAY 144 struct timeval tv; 145 #elif defined(ROAR_HAVE_TIME) 146 time_t now; 147 #endif 148 149 if ( rt == NULL ) { 150 roar_err_set(ROAR_ERROR_FAULT); 151 return -1; 152 } 153 154 memset(rt, 0, sizeof(struct roar_time)); 155 156 if ( clock == ROAR_CLOCK_DEFAULT ) 157 clock = ROAR_CLOCK_REALTIME; 158 159 switch (clock) { 160 case ROAR_CLOCK_REALTIME: 161 #ifdef ROAR_HAVE_GETTIMEOFDAY 162 if ( gettimeofday(&tv, NULL) == -1 ) { 163 roar_err_from_errno(); 164 return -1; 165 } 166 rt->t_sec = tv.tv_sec; 167 rt->t_ssec = (uint64_t)tv.tv_usec * (uint64_t)18446744073709ULL; 168 rt->c_freq = 1000LLU; 169 #elif defined(ROAR_HAVE_TIME) 170 now = time(NULL); 171 rt->t_sec = now; 172 rt->c_freq = 1000000000LLU; 173 #else 174 roar_err_set(ROAR_ERROR_NOTSUP); 175 return -1; 176 #endif 177 return 0; 178 break; 179 } 180 181 roar_err_set(ROAR_ERROR_NOTSUP); 182 return -1; 183 } 184 142 185 //ll
Note: See TracChangeset
for help on using the changeset viewer.