#include <xtd/console>
#include <xtd/convert>
#include <xtd/date_time>
#include <xtd/math>
#include <xtd/startup>
class program {
public:
static auto main() {
auto window = 10;
auto freq = 60 * 60 * 2;
auto d2 =
d1.add_seconds(2 * window);
auto d3 =
d1.add_seconds(-2 * window);
auto d4 =
d1.add_seconds(window / 2);
auto d5 =
d1.add_seconds(-window / 2);
auto d6 = (
d1.add_hours(2)).add_seconds(2 * window);
auto d7 = (
d1.add_hours(2)).add_seconds(-2 * window);
auto d8 = (
d1.add_hours(2)).add_seconds(window / 2);
auto d9 = (
d1.add_hours(2)).add_seconds(-window / 2);
}
private:
static bool roughly_equals(
const date_time& time,
const date_time& time_with_window,
int window_in_seconds,
int frequency_in_seconds) {
auto delta =
convert::to_int32((time_with_window - time).total_seconds_duration().count()) % frequency_in_seconds;
delta = delta > window_in_seconds ? frequency_in_seconds - delta : delta;
}
};
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static int32 to_int32(xtd::any value)
Convert xtd::any to int32.
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.hpp:85
static date_time now() noexcept
Gets a xtd::date_time object that is set to the current date and time on this computer,...
static decimal abs(decimal value)
Returns the absolute value of a decimal number.
#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:167
@ d6
The 6 key.
Definition console_key.hpp:80
@ d8
The 8 key.
Definition console_key.hpp:84
@ d9
The 9 key.
Definition console_key.hpp:86
@ d1
The 1 key.
Definition console_key.hpp:70
@ d4
The 4 key.
Definition console_key.hpp:76
@ d2
The 2 key.
Definition console_key.hpp:72
@ d5
The 5 key.
Definition console_key.hpp:78
@ d3
The 3 key.
Definition console_key.hpp:74
@ d7
The 7 key.
Definition console_key.hpp:82
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8