xtd 0.2.0
Loading...
Searching...
No Matches
xtd::time_zone_info::transition_time Class Reference
Inheritance diagram for xtd::time_zone_info::transition_time:
xtd::iequatable< transition_time > xtd::object xtd::interface xtd::equality_operators< type_t, equatable_t >

Definition

Provides information about a specific time change, such as the change from daylight saving time to standard time or vice versa, in a particular time zone.

class transition_time : public xtd::iequatable<transition_time>, public xtd::object
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
Provides information about a specific time change, such as the change from daylight saving time to st...
Definition time_zone_info.hpp:66
Inheritance
xtd::objectxtd::time_zone_info::transition_time
Implements
xtd::iequatable <>
Namespace
xtd
Library
xtd.core
Remarks
You can use the xtx::time_zone_info::transition_time structure to indicate when a transition from standard time to daylight saving time, or from daylight saving time back to standard time, occurs. This structure supports both fixed-date rules and floating-date rules. Use fixed-date rules for time transitions that occur on a specific day of a specific month (such as 2:00 A.M. on November 3). Use floating-date rules for time transitions that occur on a specific day of a specific week of a specific month (such as 2:00 A.M. on the first Sunday of November).
The following table compares the properties used in fixed-date and floating-date transitions:
Month Week Day Time
Fixed-date rule xtd::time_zone_info::transition_time::month N/A xtd::time_zone_info::transition_time::day xtd::time_zone_info::transition_time::time_of_day
Floating-date rule xtd::time_zone_info::transition_time::month xtd::time_zone_info::transition_time::week xtd::time_zone_info::transition_time::day_of_week xtd::time_zone_info::transition_time::time_of_day
For both fixed-date and floating-date transitions, the xtd::time_zone_info::transition_time::time_of_day property gets the time at which the time change occurs. For transitions from standard to daylight saving time, this is the time zone's standard time value. For transitions from daylight saving to standard time, this is the time zone's daylight saving time value. This is a xtd::date_time value whose date component is ignored; its year, month, and day value must always equal 1.
Note
An instance of the xtd::time_zone_info::transition_time structure is immutable. Once an object has been created, its values cannot be modified.
Remarks
A xtd::time_zone_info::transition_time object can be created by calling the static xtd::time_zone_info::transition_time::create_fixed_date_rule and xtd::time_zone_info::transition_time::create_floating_date_rule methods to create a fixed or floating-date rule, respectively. The starting and ending xtd::time_zone_info::transition_time objects are then supplied as parameters to the xtd::time_zone_info::adjustment_rule::create_adjustment_rule method to create a new adjustment rule that includes this transition time information.
The xtd::time_zone_info::transition_time::daylight_transition_start and xtd::time_zone_info::transition_time::daylight_transition_end properties of an xtd::time_zone_info::adjustment_rule object return a xtd::time_zone_info::transition_time object.

Public Properties

uint32 day () const noexcept
 Gets the day on which the time change occurs.
 
xtd::day_of_week day_of_week () const noexcept
 Gets the day of the week on which the time change occurs.
 
bool is_fixed_rule () const noexcept
 Gets a value indicating whether the time change occurs at a fixed date and time (such as November 1) or a floating date and time (such as the last Sunday of October).
 
uint32 month () const noexcept
 Gets the month in which the time change occurs.
 
xtd::date_time time_of_day () const noexcept
 Gets the hour, minute, and second at which the time change occurs.
 
uint32 week () const noexcept
 Gets the week of the month in which a time change occurs.
 

Public Static Methods

bool equals (const transition_time &tt) const noexcept override
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
static transition_time create_fixed_date_rule (date_time time_of_day, uint32 month, uint32 day)
 Defines a time change that uses a fixed-date rule (that is, a time change that occurs on a specific day of a specific month).
 
static transition_time create_floating_date_rule (date_time time_of_day, uint32 month, uint32 week, xtd::day_of_week day_of_week)
 Defines a time change that uses a floating-date rule (that is, a time change that occurs on a specific day of a specific week of a specific month).
 
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::iequatable< transition_time >
virtual bool equals (const transition_time &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type.
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
virtual xtd::string to_string () const noexcept
 Returns a xtd::string that represents the current object.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Member Function Documentation

◆ day()

uint32 xtd::time_zone_info::transition_time::day ( ) const
noexcept

Gets the day on which the time change occurs.

Returns
The day on which the time change occurs.
Remarks
The xtd::time_zone_info::transition_time::day property returns a valid value only if the xtd::time_zone_info::transition_time::is_fixed_date_rule property is true.
The xtd::time_zone_info::transition_time::day property value corresponds to the value of the day parameter of the xtd::time_zone_info::transition_time::create_fixed_date_rule method. If its value is greater than the number of days in the month of the transition, the transition occurs on the last day of the month.
The xtd::time_zone_info::transition_time::day property indicates the day of the month on which a fixed-date rule is applied (for example, April 15). In contrast, the xtd::time_zone_info::transition_time::day_of_week property indicates the day of the week on which a floating-date rule is applied (for example, the second Sunday of November).

◆ day_of_week()

xtd::day_of_week xtd::time_zone_info::transition_time::day_of_week ( ) const
noexcept

Gets the day of the week on which the time change occurs.

Returns
The day of the week on which the time change occurs.
Remarks
The xtd::time_zone_info::transition_time::day_of_week property returns a valid value only if the xtd::time_zone_info::transition_time::is_fixed_date_rule property is false.
The xtd::time_zone_info::transition_time::day_of_week property indicates the day of the week on which a floating-date rule is applied (for example, the second Sunday of November). In contrast, the xtd::time_zone_info::transition_time::day property indicates the day of the month on which a fixed-date rule is applied (for example, April 15).

◆ is_fixed_rule()

bool xtd::time_zone_info::transition_time::is_fixed_rule ( ) const
noexcept

Gets a value indicating whether the time change occurs at a fixed date and time (such as November 1) or a floating date and time (such as the last Sunday of October).

Returns
true if the time change rule is fixed-date; false if the time change rule is floating-date.
Remarks
A fixed-date rule indicates that the transition occurs on the same date and time of each year to which the adjustment rule applies. For example, a time change that occurs every November 3 follows a fixed-date rule. A floating-date rule indicates that the transition occurs on a specific day of a specific week of a specific month for each year to which the adjustment rule applies. For example, a time change that occurs on the first Sunday of November follows a floating-date rule.
The value of the xtd::time_zone_info::transition_time::is_fixed_date_rule property determines which properties of a xtd::time_zone_info::transition_time object have valid values. The following table indicates which properties are affected by the value of the xtd::time_zone_info::transition_time::is_fixed_date_rule property.
transition_time property is_fixed_date_rule = true is_fixed_date_rule = false
transition_time::day Valid Unused
transition_time::day_of_week Unused Valid
transition_time::week Unused Valid
transition_time::month Valid Valid
transition_time::time_of_day Valid Valid

◆ month()

uint32 xtd::time_zone_info::transition_time::month ( ) const
noexcept

Gets the month in which the time change occurs.

Returns
The month in which the time change occurs.
Remarks
Valid values for the xtd::time_zone_info::transition_time::month property range from 1 to 12.
The xtd::time_zone_info::transition_time::month property is used for both fixed-date and floating-date rules.

◆ time_of_day()

xtd::date_time xtd::time_zone_info::transition_time::time_of_day ( ) const
noexcept

Gets the hour, minute, and second at which the time change occurs.

Returns
The time of day at which the time change occurs.
Remarks
For transitions from standard time to daylight saving time, the xtd::time_zone_info::transition_time::time_of_day value represents the time of the transition in the time zone's standard time. For transitions from daylight saving time to standard time, it represents the time of the transition in the time zone's daylight saving time.
The xtd::time_zone_info::transition_time::time_of_day property defines only the time of a time change, but not its date. The date is determined by the xtd::time_zone_info::transition_time::month and xtd::time_zone_info::transition_time::day properties for fixed-rule changes, and by the xtd::time_zone_info::transition_time::month, xtd::time_zone_info::transition_time::week, and xtd::time_zone_info::transition_time::day_of_week properties for floating-rule changes. The date component of this xtd::date_time value is ignored; the value of the year, month, and day is always 1.
The xtd::time_zone_info::transition_time::time_of_day property is used for both fixed-date and floating-date transitions.

◆ week()

uint32 xtd::time_zone_info::transition_time::week ( ) const
noexcept

Gets the week of the month in which a time change occurs.

Returns
The week of the month in which the time change occurs.
Remarks
The value of the xtd::time_zone_info::transition_time::week property is used only for time changes with floating-date rules. Valid values can range from 1 to 5.
The xtd::time_zone_info::transition_time::month property defines the month in which the time change occurs. The xtd::time_zone_info::transition_time::week property determines the week on which the transition occurs. The xtd::time_zone_info::transition_time::day_of_week property defines the day of the week on which the transition occurs. The value of the xtd::time_zone_info::transition_time::week property is determined as shown in the following table.
 If the Week property value is The transition occurs on
 1 The first occurrence of the xtd::time_zone_info::transition_time::day_of_week value in xtd::time_zone_info::transition_time::month.
 2 The second occurrence of the xtd::time_zone_info::transition_time::day_of_week value in xtd::time_zone_info::transition_time::month.
 3 The third occurrence of the xtd::time_zone_info::transition_time::day_of_week value in xtd::time_zone_info::transition_time::month.
 4 The fourth occurrence of the xtd::time_zone_info::transition_time::day_of_week value in xtd::time_zone_info::transition_time::month.
 5 The last occurrence of the xtd::time_zone_info::transition_time::day_of_week value in xtd::time_zone_info::transition_time::month.
For example, if a transition occurs on the first Sunday of March, the value of the xtd::time_zone_info::transition_time::week property is 1. If it occurs on the last Sunday of March, the value of the xtd::time_zone_info::transition_time::week property is 5.

◆ create_fixed_date_rule()

static transition_time xtd::time_zone_info::transition_time::create_fixed_date_rule ( date_time  time_of_day,
uint32  month,
uint32  day 
)
static

Defines a time change that uses a fixed-date rule (that is, a time change that occurs on a specific day of a specific month).

Parameters
time_of_dayThe time at which the time change occurs. This parameter corresponds to the xtd::time_zone_info::transition_time::ttime_of_day property.
monthThe month in which the time change occurs. This parameter corresponds to the xtd::time_zone_info::transition_time::month property.
dayThe day of the month on which the time change occurs. This parameter corresponds to the xtd::time_zone_info::transition_time::day property.
Returns
Data about the time change.
Exceptions
xtd::argument_exceptionThe time_of_day parameter has a non-default date component.
-or-
The time_of_day parameter's Kind property is not unspecified.
-or-
The time_of_day parameter does not represent a whole number of milliseconds.
xtd::argument_out_of_range_exceptionThe month parameter is less than 1 or greater than 12.
-or-
The day parameter is less than 1 or greater than 31.
Remarks
This method creates a fixed-date rule (that is, a time change that occurs on a specific day of a specific month). For example, a time change that always occurs on October 28 follows a fixed-date rule.
For transitions from standard time to daylight saving time, the timeOfDay argument represents the time of the transition in the time zone's standard time. For transitions from daylight saving time to standard time, it represents the time of the transition in the time zone's daylight saving time. Note that this is a xtd::date_time value whose year, month, and date values must all equal 1.

◆ create_floating_date_rule()

static transition_time xtd::time_zone_info::transition_time::create_floating_date_rule ( date_time  time_of_day,
uint32  month,
uint32  week,
xtd::day_of_week  day_of_week 
)
static

Defines a time change that uses a floating-date rule (that is, a time change that occurs on a specific day of a specific week of a specific month).

Parameters
time_of_dayThe time at which the time change occurs. This parameter corresponds to the xtd::time_zone_info::transition_time::ttime_of_day property.
monthThe month in which the time change occurs. This parameter corresponds to the xtd::time_zone_info::transition_time::month property.
weekThe week of the month in which the time change occurs. Its value can range from 1 to 5, with 5 representing the last week of the month. This parameter corresponds to the xtd::time_zone_info::transition_time::week property
day_of_weekThe day of the week on which the time change occurs. This parameter corresponds to the xtd::time_zone_info::transition_time::day_of_week property.
Returns
Data about the time change.
Exceptions
xtd::argument_exceptionThe time_of_day parameter has a non-default date component.
-or-
The time_of_day parameter's Kind property is not unspecified.
-or-
The time_of_day parameter does not represent a whole number of milliseconds.
xtd::argument_out_of_range_exceptionThe month parameter is less than 1 or greater than 12.
-or-
The week parameter is less than 1 or greater than 5.
Remarks
This method creates a floating-date rule (that is, a time change that occurs on a specific day of a specific week of a specific month). For example, a time change that occurs on the last Sunday of October follows a floating-date rule.
For transitions from standard time to daylight saving time, the time_of_day argument represents the time of the transition in the time zone's standard time. For transitions from daylight saving time to standard time, it represents the time of the transition in the time zone's daylight saving time. Note that this is a xtd::date_time value whose year, month, and date values must all equal 1.

◆ equals() [1/2]

virtual bool xtd::object::equals ( const object obj) const
virtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.
Examples
The following code example compares the current instance with another object.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
auto object1 = new_ptr<object>();
auto object2 = new_ptr<object>();
auto object3 = object2;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
object3 = object1;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
}
// This code produces the following output :
//
// false
// false
// true
// true
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10

Reimplemented from xtd::object.

◆ equals() [2/2]

template<typename object_a_t , typename object_b_t >
static bool xtd::object::equals ( const object_a_t &  object_a,
const object_b_t &  object_b 
)
inlinestaticnoexcept

Determines whether the specified object instances are considered equal.

Parameters
object_aThe first object to compare.
object_bThe second object to compare.
Returns
true if object_a is the same instance as object_b or if both are null references or if object_a(object_b) returns true. otherwise, false.
Examples
The following code example compares different objects.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
string s1 = "Tom";
string s2 = "Carol";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "Tom";
s2 = "Tom";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "";
s2 = "Tom";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "Carol";
s2 = "";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "";
s2 = "";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
}
// This code produces the following output :
//
// object::equals("Tom", "Carol") => false
// object::equals("Tom", "Tom") => true
// object::equals("", "Tom") => false
// object::equals("Carol", "") => false
// object::equals("", "") => true
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.

The documentation for this class was generated from the following file: