Changeset 0a0dff8 in mainline


Ignore:
Timestamp:
2018-06-25T18:56:05Z (6 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d73d992
Parents:
826a0a97
Message:

Add const to time functions.

Location:
uspace/lib/c
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/time.c

    r826a0a97 r0a0dff8  
    5151#include <loc.h>
    5252#include <device/clock_dev.h>
    53 #include <thread.h>
    5453
    5554#define ASCTIME_BUF_LEN  26
     
    487486 * @param tv2 Second timeval.
    488487 */
    489 void tv_add(struct timeval *tv1, struct timeval *tv2)
     488void tv_add(struct timeval *tv1, const struct timeval *tv2)
    490489{
    491490        tv1->tv_sec += tv2->tv_sec;
     
    503502 *
    504503 */
    505 suseconds_t tv_sub_diff(struct timeval *tv1, struct timeval *tv2)
     504suseconds_t tv_sub_diff(const struct timeval *tv1, const struct timeval *tv2)
    506505{
    507506        return (tv1->tv_usec - tv2->tv_usec) +
     
    515514 *
    516515 */
    517 void tv_sub(struct timeval *tv1, struct timeval *tv2)
     516void tv_sub(struct timeval *tv1, const struct timeval *tv2)
    518517{
    519518        tv1->tv_sec -= tv2->tv_sec;
     
    531530 *
    532531 */
    533 int tv_gt(struct timeval *tv1, struct timeval *tv2)
     532int tv_gt(const struct timeval *tv1, const struct timeval *tv2)
    534533{
    535534        if (tv1->tv_sec > tv2->tv_sec)
     
    551550 *
    552551 */
    553 int tv_gteq(struct timeval *tv1, struct timeval *tv2)
     552int tv_gteq(const struct timeval *tv1, const struct timeval *tv2)
    554553{
    555554        if (tv1->tv_sec > tv2->tv_sec)
  • uspace/lib/c/include/sys/time.h

    r826a0a97 r0a0dff8  
    6969};
    7070
     71#define TIMEVAL_MAX ((struct timeval) { .tv_sec = LONG_MAX, .tv_usec = 999999 })
     72
    7173struct timezone {
    7274        int tz_minuteswest;  /* minutes W of Greenwich */
     
    7577
    7678extern void tv_add_diff(struct timeval *, suseconds_t);
    77 extern void tv_add(struct timeval *, struct timeval *);
    78 extern suseconds_t tv_sub_diff(struct timeval *, struct timeval *);
    79 extern void tv_sub(struct timeval *, struct timeval *);
    80 extern int tv_gt(struct timeval *, struct timeval *);
    81 extern int tv_gteq(struct timeval *, struct timeval *);
     79extern void tv_add(struct timeval *, const struct timeval *);
     80extern suseconds_t tv_sub_diff(const struct timeval *, const struct timeval *);
     81extern void tv_sub(struct timeval *, const struct timeval *);
     82extern int tv_gt(const struct timeval *, const struct timeval *);
     83extern int tv_gteq(const struct timeval *, const struct timeval *);
    8284extern void gettimeofday(struct timeval *, struct timezone *);
    8385extern void getuptime(struct timeval *);
Note: See TracChangeset for help on using the changeset viewer.