aboutsummaryrefslogtreecommitdiffstats
path: root/pc-bios/s390-ccw/s390-time.h
blob: ed6d982371855a79d5e3e4a061e358164fd11f3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef TIME_H
#define TIME_H

static inline u64 get_clock(void)
{
    u64 r;

    asm volatile("stck %0" : "=Q" (r) : : "cc");
    return r;
}

static inline u64 get_time_ms(void)
{
    /* Bit 51 is incremented each microsecond */
    return (get_clock() >> 12) / 1000;
}

static inline u64 get_time_seconds(void)
{
    return get_time_ms() / 1000;
}

#endif