Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
parse_duration.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Roc authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_core/target_stdio/roc_core/parse_duration.h
10 //! @brief Parse duration.
11 
12 #ifndef ROC_CORE_PARSE_DURATION_H_
13 #define ROC_CORE_PARSE_DURATION_H_
14 
15 #include "roc_core/time.h"
16 
17 namespace roc {
18 namespace core {
19 
20 //! Parse duration from string.
21 //!
22 //! @remarks
23 //! The input string should be in one of the following forms:
24 //! - "<number>ns"
25 //! - "<number>us"
26 //! - "<number>ms"
27 //! - "<number>s"
28 //! - "<number>m"
29 //! - "<number>h"
30 //!
31 //! @returns
32 //! false if string can't be parsed.
33 bool parse_duration(const char* string, nanoseconds_t& result);
34 
35 } // namespace core
36 } // namespace roc
37 
38 #endif // ROC_CORE_PARSE_DURATION_H_
Time definitions.
Root namespace.
int64_t nanoseconds_t
Nanoseconds.
Definition: time.h:21
bool parse_duration(const char *string, nanoseconds_t &result)
Parse duration from string.