OK so I am getting closer but I think I am making it harder than it is.
I'm using secsTo() to get the difference between the beginning of unix time Utc and my start and end times. This works ok, but secsTo automatically converts my start and end times to utc which messes up my code because they are already in utc time (which I want). To get around this I add the difference between my time and Utc time to epoch.setTime. There has got to be a better way....
void MyWidget::getDates(){
double diff = 60*60*7; // sec*min*hours - offset for local time
epoch.setTime_t(diff);
time_t st = epoch.secsTo(stEntered);//secsTo converts both epoch and stEntered
//to utc time then finds the diff between them, so problem is that my stEntered is
//already in utc (result ends up being 7 hrs ahead of utc)
stT = double(st);
time_t et = epoch.secsTo(endEntered);
endT = double(et);
}
void MyWidget::getDates(){
double diff = 60*60*7; // sec*min*hours - offset for local time
QDateTime stEntered = startTime->dateTime();
QDateTime epoch;
epoch.setTime_t(diff);
time_t st = epoch.secsTo(stEntered);//secsTo converts both epoch and stEntered
//to utc time then finds the diff between them, so problem is that my stEntered is
//already in utc (result ends up being 7 hrs ahead of utc)
stT = double(st);
QDateTime endEntered = EnterEnd->dateTime();
time_t et = epoch.secsTo(endEntered);
endT = double(et);
}
To copy to clipboard, switch view to plain text mode
thanks for the help
Bookmarks