A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../error/error_code/../../../cpp/chrono/c/tm.html below:

std::tm - cppreference.com

Structure holding a calendar date and time broken down into its components.

[edit] Member objects seconds after the minute – [​0​61](until C++11) [​0​60](since C++11)[note 1]
(public member object) minutes after the hour – [​0​59]
(public member object) hours since midnight – [​0​23]
(public member object) day of the month – [131]
(public member object) months since January – [​0​11]
(public member object) years since 1900
(public member object) days since Sunday – [​0​6]
(public member object) days since January 1 – [​0​365]
(public member object) Daylight Saving Time flag. The value is positive if DST is in effect, zero if not and negative if no information is available.
(public member object)
  1. ↑ Range allows for a positive leap second. Two leap seconds in the same minute are not allowed (the range [​0​61] was a defect introduced in C89 and corrected in C99).
[edit] Notes

BSD, GNU and musl C library support two additional members, which are standardized in POSIX.1-2024.

seconds east of UTC
(public member object) timezone abbreviation
(public member object) [edit] Example
#include <ctime>
#include <iostream>
 
int main()
{
    std::tm tm{};
    tm.tm_year = 2022 - 1900;
    tm.tm_mday = 1;
    std::mktime(&tm);
 
    std::cout << std::asctime(&tm); // note implicit trailing '\n'
}

Possible output:

[edit] See also converts time since epoch to calendar time expressed as local time
(function) [edit] converts time since epoch to calendar time expressed as Universal Coordinated Time
(function) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4