LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
daf_base
11.0+1
include
lsst
daf
base
DateTime.h
Go to the documentation of this file.
1
// -*- lsst-c++ -*-
2
3
/*
4
* LSST Data Management System
5
* Copyright 2008, 2009, 2010 LSST Corporation.
6
*
7
* This product includes software developed by the
8
* LSST Project (http://www.lsst.org/).
9
*
10
* This program is free software: you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation, either version 3 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
19
*
20
* You should have received a copy of the LSST License Statement and
21
* the GNU General Public License along with this program. If not,
22
* see <http://www.lsstcorp.org/LegalNotices/>.
23
*/
24
25
#ifndef LSST_DAF_BASE_DATETIME_H
26
#define LSST_DAF_BASE_DATETIME_H
27
44
#include <ctime>
45
#include <sys/time.h>
46
#include <string>
47
48
// Forward declaration of the boost::serialization::access class.
49
namespace
boost {
50
namespace
serialization {
51
class
access;
52
}}
// namespace boost::serialization
53
54
namespace
lsst {
55
namespace
daf {
56
namespace
base {
57
58
class
DateTime
{
59
public
:
60
enum
Timescale
{
TAI
,
UTC
,
TT
};
61
enum
DateSystem
{
JD
,
MJD
,
EPOCH
};
62
explicit
DateTime
(
long
long
nsecs
= 0
LL
,
Timescale
scale
=
TAI
);
63
explicit
DateTime
(
double
date,
DateSystem
system =
MJD
,
Timescale
scale
=
TAI
);
64
DateTime
(
int
year,
int
month,
int
day,
int
hr,
int
min,
int
sec,
65
Timescale
scale
=
TAI
);
66
explicit
DateTime
(std::string
const
& iso8601);
67
68
long
long
nsecs
(
Timescale
scale
=
TAI
)
const
;
69
double
get
(
DateSystem
system =
MJD
,
Timescale
scale
=
TAI
)
const
;
70
std::string
toString
(
void
)
const
;
71
72
struct
tm
gmtime
(void) const;
// Always UTC
73
struct
timespec
timespec
(void) const;
// Always UTC
74
struct
timeval
timeval
(void) const;
// Always UTC
75
76
bool
operator==
(
DateTime
const
& rhs)
const
;
77
78
static
DateTime
now
(
void
);
79
80
static
void
initializeLeapSeconds
(std::string
const
& leapString);
81
82
private
:
83
long
long
_nsecs
;
84
85
double
_getMjd
(
Timescale
scale
)
const
;
86
double
_getJd
(
Timescale
scale
)
const
;
87
double
_getEpoch
(
Timescale
scale
)
const
;
88
89
void
setNsecsFromMjd
(
double
mjd,
Timescale
scale
);
90
void
setNsecsFromJd
(
double
jd,
Timescale
scale
);
91
void
setNsecsFromEpoch
(
double
epoch,
Timescale
scale
);
92
93
friend
class
boost::serialization::access
;
98
template
<
class
Archive>
void
serialize
(Archive ar,
int
const
version) {
99
ar &
_nsecs
;
100
}
101
102
};
103
104
}}}
// namespace lsst::daf::base
105
106
#endif
lsst::daf::base::DateTime::now
static DateTime now(void)
Definition:
DateTime.cc:554
lsst::daf::base::DateTime::_getEpoch
double _getEpoch(Timescale scale) const
Definition:
DateTime.cc:482
lsst::daf::base::DateTime::setNsecsFromEpoch
void setNsecsFromEpoch(double epoch, Timescale scale)
a function to convert epoch to internal nsecs
Definition:
DateTime.cc:281
lsst::daf::base::DateTime
Class for handling dates/times, including MJD, UTC, and TAI.
Definition:
DateTime.h:58
lsst::daf::base::DateTime::MJD
Definition:
DateTime.h:61
lsst::daf::base::DateTime::_getJd
double _getJd(Timescale scale) const
Definition:
DateTime.cc:474
lsst::daf::base::DateTime::operator==
bool operator==(DateTime const &rhs) const
Definition:
DateTime.cc:547
lsst::daf::base::DateTime::setNsecsFromJd
void setNsecsFromJd(double jd, Timescale scale)
a function to convert JD to internal nsecs
Definition:
DateTime.cc:272
lsst::daf::base::DateTime::serialize
void serialize(Archive ar, int const version)
Definition:
DateTime.h:98
lsst::daf::base::DateTime::setNsecsFromMjd
void setNsecsFromMjd(double mjd, Timescale scale)
a function to convert MJD to interal nsecs
Definition:
DateTime.cc:246
lsst::daf::base::DateTime::initializeLeapSeconds
static void initializeLeapSeconds(std::string const &leapString)
Definition:
DateTime.cc:568
lsst::afw::table::LL
Definition:
AmpInfo.h:38
lsst::daf::base::DateTime::nsecs
long long nsecs(Timescale scale=TAI) const
Definition:
DateTime.cc:441
lsst::daf::base::DateTime::Timescale
Timescale
Definition:
DateTime.h:60
lsst::daf::base::DateTime::_nsecs
long long _nsecs
Nanoseconds since Unix epoch.
Definition:
DateTime.h:83
lsst::daf::base::DateTime::DateSystem
DateSystem
Definition:
DateTime.h:61
lsst::daf::base::DateTime::EPOCH
Definition:
DateTime.h:61
lsst::afw.display.ds9.scale
def scale
Definition:
ds9.py:91
lsst::daf::base::DateTime::_getMjd
double _getMjd(Timescale scale) const
Definition:
DateTime.cc:456
lsst::daf::base::DateTime::gmtime
struct tm gmtime(void) const
Definition:
DateTime.cc:492
lsst::daf::base::DateTime::JD
Definition:
DateTime.h:61
lsst::daf::base::DateTime::TT
Definition:
DateTime.h:60
lsst::daf::base::DateTime::timespec
struct timespec timespec(void) const
Definition:
DateTime.cc:511
lsst::daf::base::DateTime::access
friend class boost::serialization::access
Definition:
DateTime.h:93
lsst::daf::base::DateTime::toString
std::string toString(void) const
Definition:
DateTime.cc:533
lsst::daf::base::DateTime::DateTime
DateTime(long long nsecs=0LL, Timescale scale=TAI)
Definition:
DateTime.cc:291
lsst::daf::base::DateTime::TAI
Definition:
DateTime.h:60
lsst::daf::base::DateTime::UTC
Definition:
DateTime.h:60
lsst::daf::base::DateTime::timeval
struct timeval timeval(void) const
Definition:
DateTime.cc:522
Generated on Thu Sep 24 2015 02:29:18 for LSSTApplications by
1.8.5