STIR  6.2.0
Files | Classes | Functions
Items related to date/time processing
Collaboration diagram for Items related to date/time processing:

Files

file  date_time_functions.cxx
 Functions for date-time conversions.
 
file  date_time_functions.h
 Functions for date-time conversions.
 
file  test_DateTime.cxx
 A simple program to test the date-time conversions.
 

Classes

struct  stir::DateTimeStrings
 A simple structure to hold 2 strings (date and time) More...
 
class  stir::DateTimeTest
 Class with tests for date time functions. More...
 

Functions

int stir::time_zone_offset_in_secs ()
 returns the current time_zone in seconds (without DST)The result is independent of DST.
 
int stir::current_time_zone_and_DST_offset_in_secs ()
 returns the current time_zone in seconds (taking DST into account) More...
 
std::string stir::DICOM_date_time_to_DT (const std::string &date, const std::string &time, const std::string &TZ="")
 concatenate date, time and optional time_zone info.Minimal checks on format are performed, calling error() if input is incorrect.
 
double stir::DICOM_datetime_to_secs_since_Unix_epoch (const std::string &str, bool silent=false)
 convert DICOM DT string to seconds since the Unix epoch (i.e. 1 Jan 1970 00:00:00 UTC) More...
 
std::string stir::secs_since_Unix_epoch_to_DICOM_datetime (double secs, int time_zone_offset_in_secs=current_time_zone_and_DST_offset_in_secs())
 convert epoch to DICOM DT string in specified time zone (+3600 is CET)
 
DateTimeStrings stir::DICOM_datetime_to_Interfile (const std::string &str)
 Convert from DICOM DT to Interfile.
 
std::string stir::Interfile_datetime_to_DICOM (const DateTimeStrings &)
 Convert from Interfile to DICOM DT.
 
double stir::Interfile_datetime_to_secs_since_Unix_epoch (const DateTimeStrings &, bool silent=false)
 convert Interfile DateTime strings to seconds since the Unix epoch (i.e. 1 Jan 1970 00:00:00 UTC)Interfile uses a format year 1900:01:01, time 02:01:00.00. More...
 
DateTimeStrings stir::secs_since_Unix_epoch_to_Interfile_datetime (double secs, int time_zone_offset_in_secs=current_time_zone_and_DST_offset_in_secs())
 convert epoch to Interfile date-times string in specified time zone (+3600 is CET)
 

Detailed Description

Function Documentation

◆ current_time_zone_and_DST_offset_in_secs()

int stir::current_time_zone_and_DST_offset_in_secs ( )

returns the current time_zone in seconds (taking DST into account)

See also
time_zone_offset_in_secs()

References stir::time_zone_offset_in_secs().

Referenced by stir::DateTimeTest::run_tests().

◆ DICOM_datetime_to_secs_since_Unix_epoch()

double stir::DICOM_datetime_to_secs_since_Unix_epoch ( const std::string &  str,
bool  silent = false 
)

convert DICOM DT string to seconds since the Unix epoch (i.e. 1 Jan 1970 00:00:00 UTC)

  • str A DICOM date-time character string in the format: YYYYMMDDHHMMSS.FFFFFF&ZZXX
  • silent if true, silence warnings about TZ info not being present Time_Zone info is given by "&ZZXX", with & = "+" or "-", and ZZ = Hours and XX = Minutes of offset w.r.t. UTC. If no TZ is given, the local time_zone with DST is used. A warning() is then issued, unless silent=true.

References stir::error(), and stir::standardise_interfile_keyword().

Referenced by stir::DICOM_datetime_to_Interfile(), stir::Interfile_datetime_to_secs_since_Unix_epoch(), and stir::DateTimeTest::run_tests().

◆ Interfile_datetime_to_secs_since_Unix_epoch()

double stir::Interfile_datetime_to_secs_since_Unix_epoch ( const DateTimeStrings ,
bool  silent = false 
)

convert Interfile DateTime strings to seconds since the Unix epoch (i.e. 1 Jan 1970 00:00:00 UTC)Interfile uses a format year 1900:01:01, time 02:01:00.00.

Uses DICOM conventions for specifying the time_zone, i.e. appending "&ZZXX", with & = "+" or "-", and ZZ = Hours and XX = Minutes of offset w.r.t. UTC.

References stir::DICOM_datetime_to_secs_since_Unix_epoch(), and stir::Interfile_datetime_to_DICOM().

Referenced by stir::InterfileHeader::post_processing(), and stir::DateTimeTest::run_tests().