qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

s390-time.h (360B)


      1 #ifndef TIME_H
      2 #define TIME_H
      3 
      4 static inline u64 get_clock(void)
      5 {
      6     u64 r;
      7 
      8     asm volatile("stck %0" : "=Q" (r) : : "cc");
      9     return r;
     10 }
     11 
     12 static inline u64 get_time_ms(void)
     13 {
     14     /* Bit 51 is incremented each microsecond */
     15     return (get_clock() >> 12) / 1000;
     16 }
     17 
     18 static inline u64 get_time_seconds(void)
     19 {
     20     return get_time_ms() / 1000;
     21 }
     22 
     23 #endif