blob: 7709695a4c393a4542c11654103ed912244f581a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#ifndef TOOL_CXX
#define TOOL_CXX
#include <time.h>
#include "TOOL.h"
int
TOOL::string2int( string s_digit )
{
auto const char *digit = s_digit.c_str();
int result = 0;
// Convert each digit char and add into result.
while (*digit >= '0' && *digit <='9') {
result = (result * 10) + (*digit - '0');
digit++;
}
// Check that there were no non-digits at end.
if (*digit != 0) {
return -1;
}
return result;
}
long
TOOL::unixtime()
{
return (long) time( NULL );
}
#endif
|