Skip to content

Commit 464dab8

Browse files
committed
Updated documentation and added new functions
1 parent 96cb946 commit 464dab8

File tree

13 files changed

+567
-34
lines changed

13 files changed

+567
-34
lines changed

include/time_shield_cpp/parts/constants.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@
1111

1212
namespace time_shield {
1313

14+
/// \defgroup time_constants Time Constants
15+
/// \brief A collection of constants for time calculations and conversions.
16+
///
17+
/// This group includes constants for time units (nanoseconds, microseconds, milliseconds, seconds, minutes, hours, days),
18+
/// and other values related to the representation of time, such as UNIX and OLE epochs.
19+
///
20+
/// ### Key Features:
21+
/// - Provides constants for common time conversions.
22+
/// - Includes limits and special values like MAX_YEAR and ERROR_YEAR.
23+
///
24+
/// ### Example Usage:
25+
/// ```cpp
26+
/// int64_t milliseconds_in_a_day = time_shield::MS_PER_DAY;
27+
/// ```
28+
///
29+
/// \{
30+
1431
// Nanoseconds and microseconds
1532
constexpr int64_t NS_PER_US = 1000; ///< Nanoseconds per microsecond
1633
constexpr int64_t NS_PER_MS = 1000000; ///< Nanoseconds per millisecond
@@ -87,6 +104,8 @@ namespace time_shield {
87104
constexpr double MAX_OADATE = std::numeric_limits<double>::max(); ///< Maximum OLE automation date
88105
constexpr double AVG_DAYS_PER_YEAR = 365.25; ///< Average days per year
89106

107+
/// \}
108+
90109
}; // namespace time_shield
91110

92111
#endif // _TIME_SHIELD_CONSTANTS_HPP_INCLUDED

include/time_shield_cpp/parts/date_struct.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@
88

99
namespace time_shield {
1010

11+
/// \ingroup time_structures
1112
/// \brief Structure to represent a date.
1213
struct DateStruct {
1314
int64_t year; ///< Year component of the date.
14-
int mon; ///< Month component of the date (1-12).
15-
int day; ///< Day component of the date (1-31).
15+
int32_t mon; ///< Month component of the date (1-12).
16+
int32_t day; ///< Day component of the date (1-31).
1617
};
1718

19+
/// \ingroup time_structures
1820
/// \brief Creates a DateStruct instance.
1921
/// \param year The year component of the date.
2022
/// \param mon The month component of the date, defaults to 1 (January).
2123
/// \param day The day component of the date, defaults to 1.
2224
/// \return A DateStruct instance with the provided date components.
2325
inline const DateStruct create_date_struct(
2426
int64_t year,
25-
int mon = 1,
26-
int day = 1) {
27+
int32_t mon = 1,
28+
int32_t day = 1) {
2729
DateStruct data{year, mon, day};
2830
return data;
2931
}

include/time_shield_cpp/parts/date_time_struct.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace time_shield {
1010

11+
/// \ingroup time_structures
1112
/// \brief Structure to represent date and time.
1213
struct DateTimeStruct {
1314
int64_t year; ///< Year component of the date.
@@ -19,6 +20,7 @@ namespace time_shield {
1920
int ms; ///< Millisecond component of time (0-999)
2021
};
2122

23+
/// \ingroup time_structures
2224
/// \brief Creates a DateTimeStruct instance.
2325
/// \param year The year component of the date.
2426
/// \param mon The month component of the date, defaults to 1 (January).

include/time_shield_cpp/parts/enums.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@
1111

1212
namespace time_shield {
1313

14+
/// \defgroup time_enums Time Enumerations
15+
/// \brief Enumerations for time-related concepts.
16+
///
17+
/// This group contains various enums that represent time-related concepts such as
18+
/// weekdays, months, time zones, and formatting options.
19+
///
20+
/// ### Key Features:
21+
/// - Defines enumerations for consistent handling of weekdays, months, and other time units.
22+
/// - Provides utility functions for converting enum values to string representations.
23+
///
24+
/// ### Example Usage:
25+
/// ```cpp
26+
/// auto weekday = time_shield::Weekday::MON;
27+
/// std::cout << time_shield::to_cstr(weekday, time_shield::FormatType::FULL_NAME); // "Monday"
28+
/// ```
29+
///
30+
/// \{
31+
1432
/// Enumeration of the format options for representing a weekday or month.
1533
enum FormatType {
1634
UPPERCASE_NAME = 0, ///< Uppercase short name
@@ -255,6 +273,8 @@ namespace time_shield {
255273
EUROPEAN_TIME, ///< European time format (e.g., "12:30")
256274
};
257275

276+
/// \}
277+
258278
}; // namespace time_shield
259279

260280
#endif // _TIME_SHIELD_ENUMS_HPP_INCLUDED

0 commit comments

Comments
 (0)