mirror of
https://github.com/OpenVPN/openvpn3.git
synced 2024-09-20 20:13:05 +02:00
f8547529c9
size_t and ssize_t.
42 lines
815 B
C++
42 lines
815 B
C++
#include <iostream>
|
|
|
|
#include <openvpn/common/size.hpp>
|
|
#include <openvpn/common/exception.hpp>
|
|
|
|
#include <openvpn/time/time.hpp>
|
|
|
|
using namespace openvpn;
|
|
|
|
int main()
|
|
{
|
|
try {
|
|
Time::reset_base();
|
|
|
|
const Time until = Time::now() + Time::Duration::seconds(5);
|
|
|
|
Time::base_type last_sec = 0;
|
|
Time::type last_frac = 0;
|
|
|
|
while (true)
|
|
{
|
|
const Time t = Time::now();
|
|
if (t >= until)
|
|
break;
|
|
const Time::base_type sec = t.seconds_since_epoch();
|
|
const Time::type frac = t.fractional_binary_ms();
|
|
if (sec != last_sec || frac != last_frac)
|
|
{
|
|
std::cout << sec << ' ' << frac << std::endl;
|
|
last_sec = sec;
|
|
last_frac = frac;
|
|
}
|
|
}
|
|
}
|
|
catch (const std::exception& e)
|
|
{
|
|
std::cerr << "Exception: " << e.what() << std::endl;
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|