summaryrefslogtreecommitdiff
path: root/rpmio/tsw.c
blob: f9c4518e49fd9192c3c1ac84da56d24377de2540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "system.h"
#include <rpmsw.h>
#include "debug.h"

int
main(int argc, char *argv[])
{
    struct rpmsw_s begin, end;
    rpmtime_t diff;
    int scale = 1000 * 1000;
    int nsecs = 5;

    diff = rpmswInit();

fprintf(stderr, "*** Sleeping for %d secs ... ", nsecs);
    (void) rpmswNow(&begin);
    sleep(nsecs);
    (void) rpmswNow(&end);

    diff = rpmswDiff(&end, &begin);
fprintf(stderr, "measured %u.%06u secs\n", (unsigned)diff/scale, (unsigned)diff%scale);

    return 0;

}