query time slice code, untested but compiling