~mbogomilov/maus/devel3

« back to all changes in this revision

Viewing changes to src/common_cpp/DataStructure/DateTime.cc

  • Committer: Durga Rajaram
  • Date: 2014-01-14 04:39:44 UTC
  • mfrom: (663.38.24 merge)
  • mto: (698.1.1 release)
  • mto: This revision was merged to the branch mainline in revision 693.
  • Revision ID: durga@fnal.gov-20140114043944-qf0i8nksnwu74cll
candidate 0.7.6 - trunk r1026

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#include <sstream>
18
18
#include <iostream>
19
19
 
20
 
#include "src/legacy/Interface/Squeal.hh"
 
20
#include "Utils/Exception.hh"
21
21
#include "src/common_cpp/DataStructure/DateTime.hh"
22
22
 
23
23
namespace MAUS {
44
44
 
45
45
void DateTime::SetDateTime(std::string datetime) {
46
46
    if (!CheckFormat(datetime))
47
 
        throw(Squeal(Squeal::recoverable,
 
47
        throw(Exception(Exception::recoverable,
48
48
          "Malformatted date time string "+datetime+\
49
49
          " should be like YYYY-MM-DDTHH:MM:SS.mmmmmm", "DateTime::SetDateTime"
50
50
        ));
67
67
        out &= Check(datetime.substr(20, 6), 0, 1000000); // milliseconds
68
68
        out &= CheckSeparators(datetime); // separators
69
69
        return out;
70
 
    } catch(Squeal squee) {
 
70
    } catch(Exception exc) {
71
71
        return false;
72
72
    }
73
73
}
84
84
    out_test.width(some_string.size());
85
85
    out_test << out;
86
86
    if (out_test.str() != some_string) {
87
 
        throw(Squeal(Squeal::recoverable,
 
87
        throw(Exception(Exception::recoverable,
88
88
              "Failed to convert "+some_string+" to an int",
89
89
              "DateTime::ToInt"));
90
90
    }
122
122
    } else if (month == "12") {
123
123
        return Check(day, 1, 32);
124
124
    } else {
125
 
            throw(Squeal(Squeal::recoverable, "Could not resolve month "+month,
 
125
            throw(Exception(Exception::recoverable, "Could not resolve month "+month,
126
126
                         "DateTime::CheckDay"));
127
127
    }
128
128
}