将minutes :: rep转换为hours :: rep

时间:2016-10-06 14:39:29

标签: c++ linux date c++11 chrono

我应该如何继续将Sub Proper() Dim ws As Object Dim LCell As Range 'Move through each sheet in your spreadsheet For Each ws In ActiveWorkbook.Sheets ' Convert all constants and text values to proper case For Each LCell In Cells.SpecialCells(xlConstants, xlTextValues) LCell.Value = Application.WorksheetFunction.Proper(LCell) Next Next ws End Sub 类型值转换为小时制表示。

std::chrono::minutes::rep

1 个答案:

答案 0 :(得分:5)

minutes::rep time = 4;
std::cout << time;  // outputs as minutes, need in hours

因为time只是一个(实现定义的)整数类型,它与minuteshours无关,并且对基础时间表示没有任何了解

您希望留在duration领域:

minutes time{4};
auto as_hours = std::duration_cast<hours>(time);
std::cout << as_hours.count(); // prints 0

或者,可能:

auto as_hours_dbl = std::duration_cast<duration<double, hours::period>>(time);
std::cout << as_hours_dbl.count(); // prints 0.0666667