STIR  6.2.0
date_time_functions.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2020, University College London
3  This file is part of STIR.
4 
5  SPDX-License-Identifier: Apache-2.0
6 
7  See STIR/LICENSE.txt for details
8 */
9 
19 #ifndef __date_time_functions_H__
20 #define __date_time_functions_H__
21 
22 #include "stir/common.h"
23 #include <string>
24 
25 START_NAMESPACE_STIR
26 
33 
40 
48 std::string DICOM_date_time_to_DT(const std::string& date, const std::string& time, const std::string& TZ = "");
49 
59 double DICOM_datetime_to_secs_since_Unix_epoch(const std::string& str, bool silent = false);
60 
65 std::string secs_since_Unix_epoch_to_DICOM_datetime(double secs,
67 
73 {
74  DateTimeStrings() {}
75  DateTimeStrings(const std::string& date, const std::string& time)
76  : date(date),
77  time(time)
78  {}
79 
80  std::string date, time;
81 };
82 
84 
86 DateTimeStrings DICOM_datetime_to_Interfile(const std::string& str);
87 
89 
92 
101 double Interfile_datetime_to_secs_since_Unix_epoch(const DateTimeStrings&, bool silent = false);
102 
110 
111 END_NAMESPACE_STIR
112 
113 #endif // __date_time_functions_H__
int time_zone_offset_in_secs()
returns the current time_zone in seconds (without DST)The result is independent of DST...
Definition: date_time_functions.cxx:31
DateTimeStrings secs_since_Unix_epoch_to_Interfile_datetime(double secs, int time_zone_offset_in_secs)
convert epoch to Interfile date-times string in specified time zone (+3600 is CET) ...
Definition: date_time_functions.cxx:253
A simple structure to hold 2 strings (date and time)
Definition: date_time_functions.h:72
double Interfile_datetime_to_secs_since_Unix_epoch(const DateTimeStrings &intf, bool silent)
convert Interfile DateTime strings to seconds since the Unix epoch (i.e. 1 Jan 1970 00:00:00 UTC)Inte...
Definition: date_time_functions.cxx:247
double DICOM_datetime_to_secs_since_Unix_epoch(const std::string &str_org, bool silent)
convert DICOM DT string to seconds since the Unix epoch (i.e. 1 Jan 1970 00:00:00 UTC) ...
Definition: date_time_functions.cxx:149
int current_time_zone_and_DST_offset_in_secs()
returns the current time_zone in seconds (taking DST into account)
Definition: date_time_functions.cxx:53
DateTimeStrings DICOM_datetime_to_Interfile(const std::string &str)
Convert from DICOM DT to Interfile.
Definition: date_time_functions.cxx:221
std::string secs_since_Unix_epoch_to_DICOM_datetime(double secs, int time_zone_offset_in_secs)
convert epoch to DICOM DT string in specified time zone (+3600 is CET)
Definition: date_time_functions.cxx:201
std::string Interfile_datetime_to_DICOM(const DateTimeStrings &dt)
Convert from Interfile to DICOM DT.
Definition: date_time_functions.cxx:232
std::string DICOM_date_time_to_DT(const std::string &date_org, const std::string &time_org, const std::string &TZ_org)
concatenate date, time and optional time_zone info.Minimal checks on format are performed, calling error() if input is incorrect.
Definition: date_time_functions.cxx:95
basic configuration include file