I am trying to create a simple input to simulate Real Time Clock values. All I want the code to do is calculate to difference in time between the two tm structs (Time1Start and Time1End). The month, day, year, etc
do not matter as these calculations are assumed to be done on the same day.
I think it is right to assume that the hours and minutes fall on the first day of 1900 since it hasn't been initialized.
I am getting a warning and a couple errors as soon as I try to manipulate either struct. The code is as follows:
#include <time.h>
struct tm Time1Start;
Time1Start.tm_hour = 0; //start of day - errors start here (line 38)
Time1Start.tm_min = 0;
struct tm Time1End;
Time1End.tm_hour = 17; //5:XX o'clock
Time1End.tm_min = 30; //5:30
double seconds;
double minutes;
seconds = difftime(mktime(Time1Start), mktime(Time1End));
minutes = seconds / 60;
The errors I recieve are:
build.h:38: warning: (374) missing basic type; int assumed
build.h:38: error: (984) type redeclared
build.h:38: error: (1098) conflicting declarations for variable "Time1Start" (build.h:37)
I am running in MPLAB X IDE v3.30
using the X8 compiler
.
Please help