#include <iostream>
#include <chrono>
#include <ctime>
int main ()
{
usingnamespace std::chrono;
//http://stackoverflow.com/questions/13439401/why-does-chrono-have-its-own-namespace
std::time_t current = system_clock::to_time_t ( system_clock::now() );
//converts current time into an object of the traditional time type of C and POSIX, type time_t
struct std::tm local_time = *localtime(¤t);//local time conversion
//struct std::tm gm_time = *gmtime(¤t);//greenwich mean time conversion
//time_t needs to be converted to type tm which has data members for hour, min, sec, etc
if((local_time.tm_hour >= 7)&&(local_time.tm_hour <= 9))
{
std::cout << "OK \n";
}
else
{
std::cout << "Not OK \n";
}
}
Thanks i will give this ago, basically i want to simply allow connection standard but between the 0700-0900 restrict a couple of things then allow again after set time.