Problem using time = millis(); on ESP32 Thing +

I am trying to get a relative timing between readings. I found time = millis(); in Arduino reference library. It supposedly keeps track of milliseconds since program initiation. Here is a simple program and the important error messages. I thought I had found a solution where TIME functions were updated for Teensyduino, but it doesn’t work for this board.

Any suggestion for new avenues of software to explore or a more appropriate forum will be appreciated.

unsigned long time;

void setup() {
  Serial.begin(9600);
}
void loop() {
  Serial.print("Time: ");
  time = millis();

  Serial.println(time); //prints time since program started
  delay(1000);          // wait a second so as not to send massive amounts of data

‘long unsigned int time’ redeclared as different kind of symbol

time_t _EXFUN(time, (time_t *_timer));

Time_test:8:8: error: assignment of function ‘time_t time(time_t*)’

The variable name “time” is used inside the Arduino libraries and this causes the compiler error. Change your program to something like “unsigned long timeVar;” and replace the occurrences of “time” to “timeVar” and you will be good to go.

Thanks. It did work like a charm. I appreciate the help. Just getting back into programming. My exposure to Fortran and basic was a long time ago.

I remember back when I programmed in FTN and F77 and I worked for a (now defunct) manufacturer and supported the various compilers and languages. But back then I didn’t do “C” or “C++” and am learning those now. Even back then I was told that COBOL was dead but now I’m being offerred jobs to maintain COBOL language sites that pay much better than similar jobs for “sexier” languages :). Anyone remember RPGII or ADA?

Well, I never actually used ADA, but I did do a program in RPG-II for my “comparative languages” course, and recall that I had two comments about it (this was about 1978 or so):

First, that any man who programmed in RPG-II for two years or more need never get married as there is no way that one woman in one lifetime can hen-peck him as much as that computer has! :slight_smile:

Second, RPG-II was an attempt to make an IBM 360 look like a 401 Accounting Machine (which was programmed using a wiring board – and which I had done in high school, graduating in 1972).