Changeset 2d1fde3b in mainline


Ignore:
Timestamp:
2006-05-28T22:26:07Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c042bdd
Parents:
0b99e40
Message:

Correct realtime clock communication

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libc/generic/time.c

    r0b99e40 r2d1fde3b  
    3939/* Pointers to public variables with time */
    4040struct {
    41         volatile sysarg_t seconds;
     41        volatile sysarg_t seconds1;
    4242        volatile sysarg_t useconds;
    43         volatile sysarg_t useconds2;
     43        volatile sysarg_t seconds2;
    4444} *ktime = NULL;
    4545
     
    5858{
    5959        void *mapping;
    60         sysarg_t seconds,useconds;
     60        sysarg_t s1, s2;
    6161        sysarg_t t1;
    6262        int res;
     
    7979        tz->tz_dsttime = DST_NONE;
    8080retry:
    81         seconds = ktime->seconds;
    82         read_barrier();
     81        s1 = ktime->seconds1;
    8382        tv->tv_usec = ktime->useconds;
    8483        read_barrier();
    85         tv->tv_sec = ktime->seconds;
    86         if (tv->tv_usec == 0 && seconds == tv->tv_sec &&
    87             ktime->useconds2 != 0) {
    88                 read_barrier();
    89                 goto retry;
    90         }
    91 
    92         if (seconds != tv->tv_sec)
    93                 tv->tv_usec = ktime->useconds;
     84        s2 = ktime->seconds2;
     85        if (s1 != s2) {
     86                tv->tv_usec = 0;
     87                tv->tv_sec = s1 > s2 ? s1 : s2;
     88        } else
     89                tv->tv_sec = s1;
    9490
    9591        return 0;
Note: See TracChangeset for help on using the changeset viewer.