mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-05 21:54:27 +02:00
Updated Boost datetime Examples Translated (markdown)
@@ -386,14 +386,16 @@ look if ported to this library.
|
||||
using namespace std::chrono;
|
||||
using namespace date;
|
||||
// get the current time from the clock -- one second resolution
|
||||
auto now = floor<seconds>(current_zone()->to_local(system_clock::now()).first);
|
||||
auto now = floor<seconds>(current_zone()->
|
||||
to_local(system_clock::now()).first);
|
||||
// Get the date part out of the time
|
||||
auto today = floor<days>(now);
|
||||
auto tomorrow = today + days{1}; // midnight
|
||||
for (auto i = now; i < tomorrow; i += 1h)
|
||||
std::cout << i << '\n';
|
||||
auto remaining = tomorrow - now;
|
||||
std::cout << "Time left until midnight: " << make_time(remaining) << '\n';
|
||||
std::cout << "Time left until midnight: "
|
||||
<< make_time(remaining) << '\n';
|
||||
}
|
||||
|
||||
<a name="Local_to_UTC_Conversion"></a>
|
||||
|
Reference in New Issue
Block a user