Shows how to use xtd::date_time class with ticks constructors.
#include <xtd/xtd>
class program {
public:
static auto main() {
auto century_begin = date_time {2001, 1, 1};
auto current_date = date_time::now();
auto elapsed_ticks = current_date.ticks() - century_begin.ticks();
auto elapsed_span = time_span {elapsed_ticks};
console::write_line("Elapsed from the beginning of the century to {:f}:", current_date);
console::write_line(" {:N0} nanoseconds", elapsed_ticks * 100);
console::write_line(" {:N0} ticks", elapsed_ticks);
console::write_line(" {:N2} seconds", elapsed_span.total_seconds());
console::write_line(" {:N2} minutes", elapsed_span.total_minutes());
console::write_line(" {:N0} days, {} hours, {} minutes, {} seconds", elapsed_span.days(), elapsed_span.hours(),
elapsed_span.minutes(), elapsed_span.seconds());
}
};
#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:168