c - run func() based on what time it is -



c - run func() based on what time it is -

i wrote code monitors directory dir inotify() , when file gets moved in dir .txt output of file(its nfcapd file flows of network interface). happens every 5 minutes.

after that, used snort's dpx starter kit, can extend snort writing own preprocessor. preprocessor,like others, function that's executed every time new packet available. problem want, when new file gets exported previous code(so every 5 minutes), read file within preprocessor's function.

so, there way of getting time , executing if it's desired time?

if (time 15:36){ func(output.txt);}

i'm writing in c.

thanks

you can following:

#include <time.h> ... time_t t = time(null); //obtain current time in seconds struct tm broken_time; localtime_r(&t, &broken_time); // split time fields if(broken_time.tm_hour == 15 && broken_time.tm_min == 36) { //perform check func(output.txt); }

c timer

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -