Hi, everyone. I wanna ask how to obtain current minute in c++? Can someone help to show the simplest and not too complicated code? because I am still a beginner..... Thanks.
That construct makes four assumptions, none of which is guaranteed to be true:
a. std::time_t is an integral type.
b. std::time(nullptr) yields a value which is the number of completed seconds since the start of epoch
c. the epoch started on some precise hour boundary.
d. there hasn't been any leap second since the end of the last completed minute.
If a., b., c. and d. hold: % the remainder after integer division by 3600 (seconds per hour) would yield the number of completed seconds elapsed since the most recent completed hour / performing an integer division by 60 (seconds per minute) on that would yield the number of completed minutes elapsed since the most recent completed hour.