base_constr.cc 1.19 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
/* this is <base_constr.cc>
 * ----------------------------------------------------------------------------
 *
4
 * $Id: base_constr.cc,v 1.4 2000-12-22 13:58:03 forbrig Exp $
thomas.forbriger's avatar
thomas.forbriger committed
5
6
7
8
9
10
11
 *
 * 09/08/2000 by Thomas Forbriger (IfG Stuttgart)
 *
 * TBaseClassTime constructor
 *
 * REVISIONS and CHANGES
 *    09/08/2000   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
12
 *    06/09/2000   V1.1   added character array initializer
13
14
 *    22/12/2000   V1.2   changed namespace time to libtime (resolved conflict
 *                        with system time library)
thomas.forbriger's avatar
thomas.forbriger committed
15
16
17
18
19
20
21
22
 *
 * ============================================================================
 */

#include "libtime++.h"
#include <cstring>
#include <iostream>

23
namespace libtime {
thomas.forbriger's avatar
thomas.forbriger committed
24

thomas.forbriger's avatar
thomas.forbriger committed
25
void TBaseClassTime::char_read(char *timestring)
thomas.forbriger's avatar
thomas.forbriger committed
26
{
thomas.forbriger's avatar
thomas.forbriger committed
27
  if (time_kernel::time_read(&Mtime_Ts, timestring)!=EXIT_SUCCESS)
thomas.forbriger's avatar
thomas.forbriger committed
28
  {
thomas.forbriger's avatar
thomas.forbriger committed
29
    std::cerr << "TBaseClassTime could not initialize time structure "
thomas.forbriger's avatar
thomas.forbriger committed
30
              << "from string:\n" << std::string(timestring) << "\n";
thomas.forbriger's avatar
thomas.forbriger committed
31
32
33
34
    std::abort();
  }
}

thomas.forbriger's avatar
thomas.forbriger committed
35
36
37
38
39
40
41
void TBaseClassTime::string_read(const std::string &timestring)
{
  char charstring[TIME_SLEN+2];
  std::strncpy(charstring, timestring.c_str(), TIME_SLEN+1);
  char_read(charstring);
}

thomas.forbriger's avatar
thomas.forbriger committed
42
43
44
};
 
/* ----- END OF base_constr.cc ----- */