I need to write a C program in the LINUX such that
First Condition: from morning 8 am to evening 6 pm and also if the number of packets in the network which is being counted by the Tshark in the terminal window is greater than 500 then Switch will be turned ON and if the packets is less than 500 the HUB should turn ON.
Second condition is from evening 6 pm to morning 7.59 am and if the number of packets is less than 500 in the network then HUB will be turned ON and if it is greater than 500 Switch will be turned ON.
So the help I need is to write a C program that should monitor/count the Tshark packets in the terminal window and also simultaneously the system time, these both are important aspects.