COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
timeutils.h
Go to the documentation of this file.
1 /********************************************************************
2 * Copyright (C) 2015 by Interstel Technologies, Inc.
3 * and Hawaii Space Flight Laboratory.
4 *
5 * This file is part of the COSMOS/core that is the central
6 * module for COSMOS. For more information on COSMOS go to
7 * <http://cosmos-project.com>
8 *
9 * The COSMOS/core software is licenced under the
10 * GNU Lesser General Public License (LGPL) version 3 licence.
11 *
12 * You should have received a copy of the
13 * GNU Lesser General Public License
14 * If not, go to <http://www.gnu.org/licenses/>
15 *
16 * COSMOS/core is free software: you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public License
18 * as published by the Free Software Foundation, either version 3 of
19 * the License, or (at your option) any later version.
20 *
21 * COSMOS/core is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * Refer to the "licences" folder for further information on the
27 * condititons and terms to use this software.
28 ********************************************************************/
29 
30 // just for the old code for timeval, deprecated
31 //#if defined(_MSC_VER) && (_MSC_VER >= 1020)
32 //#include <winsock.h>
33 //#endif
34 
35 #ifndef TIME_UTILS
36 #define TIME_UTILS
37 
38 #include "support/configCosmos.h"
39 #include <iostream>
40 #include <string>
41 
42 #ifndef CROSS_TYPE_arm
43 #include <chrono>
44 #include <ctime>
45 
46 class TimeUtils {
47 
48 public:
49 
50  string timeString(const std::chrono::system_clock::time_point &tp);
51  std::chrono::system_clock::time_point makeTimePoint(int year, int mon, int day, int hour, int min, int sec);
52  std::chrono::system_clock::time_point timePointUtc();
53  double secondsSinceEpoch();
54  std::chrono::system_clock::duration secondsSinceMidnight();
56 };
57 
58 #endif
59 
60 #endif
std::chrono::system_clock::time_point timePointUtc()
Definition: timeutils.cpp:80
double secondsSinceEpoch()
Definition: timeutils.cpp:91
void testSecondsSinceMidnight()
Definition: timeutils.cpp:122
Headers and definitions common to all COSMOS.
string timeString(const std::chrono::system_clock::time_point &tp)
Definition: timeutils.cpp:37
std::chrono::system_clock::time_point makeTimePoint(int year, int mon, int day, int hour, int min, int sec)
Definition: timeutils.cpp:46
Definition: timeutils.h:46
std::chrono::system_clock::duration secondsSinceMidnight()
Definition: timeutils.cpp:108