Changeset 98 for trunk/orca/op.c

Show
Ignore:
Timestamp:
03/23/06 01:35:12 (3 years ago)
Author:
krobillard
Message:

Time is now stored as double. Removed OTime.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/op.c

    r65 r98  
    144144        if( orIs(b, OT_TIME) ) 
    145145        { 
    146             OTime time; 
    147             OValue* res; 
    148  
    149             time.sec  = a->time.sec + b->time.sec; 
    150             time.usec = a->time.usec + b->time.usec; 
    151             if( time.usec > 1000000 ) 
    152             { 
    153                 time.sec  += 1; 
    154                 time.usec -= 1000000; 
    155             } 
    156  
    157             res = orRESULT; 
    158             orSetTF( res, OT_TIME ); 
    159             res->time = time; 
     146            orSeconds(a) += orSeconds(b); 
    160147            return; 
    161148        } 
     
    283270        if( orIs(b, OT_TIME) ) 
    284271        { 
    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); 
    313273            return; 
    314274        }