1/*
2 * Legal Notice
3 *
4 * This document and associated source code (the "Work") is a part of a
5 * benchmark specification maintained by the TPC.
6 *
7 * The TPC reserves all right, title, and interest to the Work as provided
8 * under U.S. and international laws, including without limitation all patent
9 * and trademark rights therein.
10 *
11 * No Warranty
12 *
13 * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
14 * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
15 * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
16 * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
17 * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
18 * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
19 * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
20 * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
21 * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
22 * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
23 * WITH REGARD TO THE WORK.
24 * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
25 * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
26 * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
27 * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
28 * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
29 * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
30 * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
31 * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
32 *
33 * Contributors
34 * - Christopher Chan-Nui
35 */
36
37/*
38 * Some basic string to number/time utilities
39 */
40
41#ifndef STRUTIL_H_INCLUDED
42#define STRUTIL_H_INCLUDED
43
44#include <string>
45#include "utilities/EGenStandardTypes.h"
46
47using namespace std;
48
49namespace TPCE {
50
51// Converts a string to a 64 bit integer, supports the suffixes
52// KMG for powers of 1000 multipliers
53extern INT64 strtoint64(const char *ptr);
54
55// Converts a string to a double, supports the suffixes
56// KMG for powers of 1000 multipliers
57extern double strtodbl(const char *ptr);
58
59// Converts a string in HH:MM:SS to a 64 bit integral number of seconds
60// HH or HH:MM are optional. Seconds over 60 may be specified.
61// (i.e. 1:00:00 and 3600 are equivalent)
62extern INT64 timestrtoint64(const char *ptr);
63
64// Converts an integral number of seconds to the string HH:MM:SS
65// HH or HH:MM may be omitted if the time value is small enough
66extern std::string int64totimestr(INT64 val);
67} // namespace TPCE
68
69#endif // STRUTIL_H_INCLUDED
70