##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::chrono::ceil(std::chrono::time_point)

From cppreference.com
< cpp‎ | chrono‎ | time point

Defined in header `<chrono>` |  |
template <class ToDuration, class Clock, class Duration> constexpr time_point<Clock, ToDuration> ceil(const time_point<Clock, Duration>& tp); |  | (since C++17)

Returns the smallest time point `t` representable in `ToDuration` that is greater or equal to `tp`.

The function does not participate in the overload resolution unless `ToDuration` is an instance of std::chrono::duration.

### [edit] Parameters

tp | - | time point to convert

### [edit] Return value

`d` rounded up to a the next time point using duration of type `ToDuration`.

### [edit] Possible implementation

    template <class T> struct is_duration : std::false_type {};
    template <class Rep, class Period> struct is_duration<
        std::chrono::duration<Rep, Period>> : std::true_type {};

    template <class To, class Clock, class FromDuration,
              class = std::enable_if_t<is_duration<To>{}>>
    constexpr std::chrono::time_point<Clock, To>
        ceil(const std::chrono::time_point<Clock, FromDuration>& tp)
    {
        return std::chrono::time_point<Clock, To>{
                   std::chrono::ceil<To>(tp.time_since_epoch())};
    }

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

time_point_cast | converts a time point to another time point on the same clock, with a different duration (function template) [edit]
floor(std::chrono::time_point) (C++17) | converts a time_point to another, rounding down (function template) [edit]
round(std::chrono::time_point) (C++17) | converts a time_point to another, rounding to nearest, ties to even (function template) [edit]
ceil(std::chrono::duration) (C++17) | converts a duration to another, rounding up (function template) [edit]
ceil | nearest integer not less than the given value (function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/chrono/time_point/ceil&oldid=81534"
Category:

- Todo no example