#include #include #include #include #include #include using namespace std; static long long getnow () { struct timeval tv; gettimeofday (&tv,NULL); return tv.tv_sec *(long long)1000000 + tv.tv_usec; } int main (int argc, char *argv[]) { glocal int ret = -1; glocal const char *filetime = "/tmp/main.last"; glocal int waittime = 3*1000000/4; // Half a second glocal.ret = (argc,argv); setproginfo ("nocracks-time",VERSION,"..."); setarg ('f',"filetime","File holding last access time",glocal.filetime,false); setarg ('w',"waittime","Return false until the waittime is over (microseconds)",glocal.waittime,false); int ret = -1; glocal long long last = 0; (glocal.filetime,true); glocal.last = atoll(line); return 0; glocal long long now = getnow(); if (glocal.now - glocal.last > glocal.waittime){ ret = 0; (glocal.filetime,false); fprintf (fout,"%Ld\n",glocal.now); return 0; } return ret; return glocal.ret; }