#include <xtd/timers/timer>
#include <xtd/console>
#include <xtd/date_time>
#include <xtd/startup>
namespace timer_example {
class program {
public:
static void main() {
set_timer();
console::write_line("\nPress the Enter key to exit the application...\n");
console::write_line("The application started at {:t}.{:d3}", date_time::now(), date_time::now().millisecond());
console::read_line();
a_timer.stop();
a_timer.close();
console::write_line("Terminating the application...");
}
static void set_timer() {
a_timer.elapsed += on_timed_event;
a_timer.auto_reset(true);
a_timer.enabled(true);
}
console::write_line("The elapsed event was raised at {:t}.{:d3}",
e.signal_time(), e.signal_time().millisecond());
}
private:
inline static timer a_timer {2'000};
};
}
Provides data for the xtd::timers::timer::elapsed event.
Definition elapsed_event_args.hpp:18
Generates an event after a set interval, with an option to generate recurring events.
Definition timer.hpp:50
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:175
Provides the xtd::timers::timer component, which allows you to raise an event on a specified interval...
Definition elapsed_event_args.hpp:11
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10