2019-07-11 14:34:31 +02:00
|
|
|
#ifndef __TVGUIDE_TIMEMANAGER_H
|
|
|
|
#define __TVGUIDE_TIMEMANAGER_H
|
2019-07-11 11:07:13 +02:00
|
|
|
|
|
|
|
#include <vdr/tools.h>
|
2020-01-06 12:51:49 +01:00
|
|
|
#include "config.h"
|
2019-07-11 11:07:13 +02:00
|
|
|
|
2019-07-11 14:34:31 +02:00
|
|
|
// --- cTimeManager -------------------------------------------------------------
|
2019-07-11 11:07:13 +02:00
|
|
|
|
2019-07-11 14:34:31 +02:00
|
|
|
class cTimeManager {
|
2019-07-11 11:07:13 +02:00
|
|
|
private:
|
|
|
|
time_t t;
|
|
|
|
time_t tStart;
|
|
|
|
time_t tEnd;
|
2020-01-06 12:51:49 +01:00
|
|
|
int displaySeconds;
|
|
|
|
eTimeFormat timeFormat;
|
2019-07-11 11:07:13 +02:00
|
|
|
public:
|
2020-01-06 12:51:49 +01:00
|
|
|
cTimeManager();
|
2019-07-11 14:34:31 +02:00
|
|
|
virtual ~cTimeManager(void);
|
2019-07-11 11:07:13 +02:00
|
|
|
static cString printTime(time_t displayTime);
|
|
|
|
void Now();
|
|
|
|
time_t GetNow() { return t; };
|
|
|
|
void AddStep(int step);
|
2020-01-06 12:51:49 +01:00
|
|
|
void DelStep(int step);
|
2019-07-11 11:07:13 +02:00
|
|
|
void SetTime(time_t newTime);
|
|
|
|
time_t Get() {return t;};
|
|
|
|
time_t GetStart() {return tStart;};
|
|
|
|
time_t GetEnd() {return tEnd;};
|
|
|
|
cString GetCurrentTime();
|
|
|
|
cString GetDate();
|
|
|
|
cString GetWeekday();
|
|
|
|
time_t getPrevPrimetime(time_t current);
|
|
|
|
time_t getNextPrimetime(time_t current);
|
|
|
|
bool tooFarInPast(time_t current);
|
|
|
|
int GetTimelineOffset();
|
|
|
|
time_t GetRounded();
|
|
|
|
bool NowVisible(void);
|
2020-01-06 12:51:49 +01:00
|
|
|
int GetDisplaySeconds(void) { return displaySeconds; };
|
2019-07-11 11:07:13 +02:00
|
|
|
void debug();
|
|
|
|
};
|
|
|
|
|
|
|
|
// --- cTimeInterval -------------------------------------------------------------
|
|
|
|
|
|
|
|
class cTimeInterval {
|
|
|
|
private:
|
|
|
|
time_t start;
|
|
|
|
time_t stop;
|
|
|
|
public:
|
|
|
|
cTimeInterval(time_t start, time_t stop);
|
|
|
|
virtual ~cTimeInterval(void);
|
|
|
|
time_t Start(void) { return start; };
|
|
|
|
time_t Stop(void) { return stop; };
|
|
|
|
cTimeInterval *Intersect(cTimeInterval *interval);
|
|
|
|
cTimeInterval *Union(cTimeInterval *interval);
|
|
|
|
};
|
|
|
|
|
2019-07-11 14:34:31 +02:00
|
|
|
#endif //__TVGUIDE_TIMEMANAGER_H
|