00001 #ifndef TIMESTAMP_H 00002 #define TIMESTAMP_H 00003 00004 /******************************************************************************* 00005 * ALMA - Atacama Large Millimeter Array 00006 * Copyright (c) ESO - European Southern Observatory, 2011 00007 * (in the framework of the ALMA collaboration). 00008 * All rights reserved. 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 *******************************************************************************/ 00024 #include <string> 00025 00026 namespace acsalarm 00027 { 00028 /* 00029 * Utility class to hold a timestamp. This class is intended primarily for use 00030 * by the cpp laser alarm source library, but it may have other uses. It is 00031 * not very sophisticated, however. 00032 */ 00033 class Timestamp 00034 { 00035 public: 00036 00037 // constructors 00038 Timestamp(); 00039 Timestamp(const Timestamp &); 00040 Timestamp(long secs, long microSecs); 00041 00042 // destructor 00043 virtual ~Timestamp(); 00044 00045 // assignment operator 00046 Timestamp & operator=(const Timestamp & rhs); 00047 00048 // equality operator 00049 int operator==(const Timestamp &rhs) const; 00050 00051 // accessor for the seconds 00052 long getSeconds() const { return seconds; } 00053 00054 // mutator for the seconds 00055 void setSeconds(long newSecs) { seconds = newSecs; } 00056 00057 // accessor for the microseconds 00058 long getMicroSeconds() const { return microSeconds; } 00059 00060 // mutator for the microseconds 00061 void setMicroSeconds(long newMicroSecs) { microSeconds = newMicroSecs; } 00062 00066 std::string toISOFormat() const; 00067 00068 private: 00069 long seconds; 00070 long microSeconds; 00071 }; 00072 } 00073 #endif