Changeset 231b3fd in mainline for uspace/drv/time/cmos-rtc/cmos-rtc.c


Ignore:
Timestamp:
2018-08-25T21:35:26Z (6 years ago)
Author:
GitHub <noreply@…>
Parents:
e2625b1a (diff), 3c45353 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jakub Jermář <jakub@…> (2018-08-25 21:35:26)
git-committer:
GitHub <noreply@…> (2018-08-25 21:35:26)
Message:

Merge 3c453534a2b093c8039d8e8059b923c71f3492a3 into e2625b1a1e5a2895b86f0e39c2d70a39e49e042a

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/time/cmos-rtc/cmos-rtc.c

    re2625b1a r231b3fd  
    7575        int clients_connected;
    7676        /** time at which the system booted */
    77         struct timeval boot_time;
     77        struct timespec boot_time;
    7878} rtc_t;
    7979
     
    204204
    205205        rtc->boot_time.tv_sec = 0;
    206         rtc->boot_time.tv_usec = 0;
     206        rtc->boot_time.tv_nsec = 0;
    207207        rtc->clients_connected = 0;
    208208
     
    331331                 */
    332332
    333                 struct timeval curtime;
     333                struct timespec curtime;
    334334
    335335                getuptime(&curtime);
    336                 tv_add(&curtime, &rtc->boot_time);
     336                ts_add(&curtime, &rtc->boot_time);
    337337                fibril_mutex_unlock(&rtc->mutex);
    338338
    339                 return time_tv2tm(&curtime, t);
     339                return time_ts2tm(&curtime, t);
    340340        }
    341341
     
    346346        }
    347347
    348         /* Microseconds are below RTC's resolution, assume 0. */
    349         t->tm_usec = 0;
     348        /* Nanoseconds are below RTC's resolution, assume 0. */
     349        t->tm_nsec = 0;
    350350
    351351        /* now read the registers */
     
    419419                result = EINVAL;
    420420        else {
    421                 struct timeval uptime;
     421                struct timespec uptime;
    422422
    423423                getuptime(&uptime);
    424424                rtc->boot_time.tv_sec = r;
    425                 rtc->boot_time.tv_usec = t->tm_usec;    /* normalized */
    426                 tv_sub(&rtc->boot_time, &uptime);
     425                rtc->boot_time.tv_nsec = t->tm_nsec;    /* normalized */
     426                ts_sub(&rtc->boot_time, &uptime);
    427427                result = EOK;
    428428        }
     
    445445        bool bcd_mode;
    446446        time_t norm_time;
    447         struct timeval uptime;
    448         struct timeval ntv;
     447        struct timespec uptime;
     448        struct timespec ntv;
    449449        int  reg_b;
    450450        int  reg_a;
     
    457457
    458458        ntv.tv_sec = norm_time;
    459         ntv.tv_usec = t->tm_usec;
     459        ntv.tv_nsec = t->tm_nsec;
    460460        getuptime(&uptime);
    461461
    462         if (tv_gteq(&uptime, &ntv)) {
     462        if (ts_gteq(&uptime, &ntv)) {
    463463                /* This is not acceptable */
    464464                return EINVAL;
     
    474474        /* boot_time must be recomputed */
    475475        rtc->boot_time.tv_sec = 0;
    476         rtc->boot_time.tv_usec = 0;
     476        rtc->boot_time.tv_nsec = 0;
    477477
    478478        /* Detect the RTC epoch */
Note: See TracChangeset for help on using the changeset viewer.