| 285 | | OTime btime; |
| 286 | | OValue* res; |
| 287 | | |
| 288 | | // http://www.dusek.ch/manual/glibc/libc_21.html |
| 289 | | |
| 290 | | btime = b->time; |
| 291 | | if( a->time.usec < btime.usec ) |
| 292 | | { |
| 293 | | int nsec = (btime.usec - a->time.usec) / 1000000 + 1; |
| 294 | | btime.usec -= 1000000 * nsec; |
| 295 | | btime.sec += nsec; |
| 296 | | } |
| 297 | | if( a->time.usec - btime.usec > 1000000 ) |
| 298 | | { |
| 299 | | int nsec = (a->time.usec - btime.usec) / 1000000; |
| 300 | | btime.usec += 1000000 * nsec; |
| 301 | | btime.sec -= nsec; |
| 302 | | } |
| 303 | | |
| 304 | | res = orRESULT; |
| 305 | | orSetTF( res, OT_TIME ); |
| 306 | | /* usec will always be positive. */ |
| 307 | | res->time.sec = a->time.sec - btime.sec; |
| 308 | | res->time.usec = a->time.usec - btime.usec; |
| 309 | | /* |
| 310 | | if( a->time.sec < time.sec ) |
| 311 | | res->time.sec = - res->time.sec; |
| 312 | | */ |
| | 272 | orSeconds(a) -= orSeconds(b); |