def current_mono(vm): _,_ = vm.decode_args() with lltype.scoped_alloc(TIMESPEC) as ts: if clock_gettime(CLOCK_MONOTONIC, ts) != 0: raise Exception("XXX") sec = rarithmetic.r_int(ts.c_tv_sec) nsec = rarithmetic.r_int(ts.c_tv_nsec) return Con_List(vm, [Con_Int(vm, sec), Con_Int(vm, nsec)])
def current(vm): _,_ = vm.decode_args() with lltype.scoped_alloc(TIMEVAL) as tp: if gettimeofday(tp, lltype.nullptr(TIMEZONEP.TO)) != 0: raise Exception("XXX") sec = rarithmetic.r_int(tp.c_tv_sec) usec = rarithmetic.r_int(tp.c_tv_usec) return Con_List(vm, [Con_Int(vm, sec), Con_Int(vm, usec * 1000)])
def test_typeof(): assert lltype.typeOf(rarithmetic.r_int(0)) == lltype.Signed assert lltype.typeOf(rclong(0)) == lltype.Signed assert lltype.Signed == CLong assert lltype.typeOf(rarithmetic.r_uint(0)) == lltype.Unsigned assert lltype.typeOf(rculong(0)) == lltype.Unsigned assert lltype.Unsigned == CULong assert lltype.typeOf(rcbyte(0)) == CByte assert lltype.typeOf(rcshort(0)) == CShort assert lltype.typeOf(rcushort(0)) == CUShort