Time and the "now()" function


im trying inject current date serial output barograph sending.
it outputs pascals, build filter log infrasound events of interest.
to make sense of data need include accurate time-stamp.

using time.h have been able inject milis() file not solve problem.
if now() work in code ok once got data out of morrass of arduino mash around reveal proper iso date time (yyyymmdd_hhmmss.ssssssss) or julian date (astronomical).

i able year() work (sort of) outputs 1970.  must missing command poll pc , pc time , dump varriable. or gps time fine.
*************



time_t t=now()+1446316592;//amazingly works cosmetic fudge
serial.print (t);
serial.print(",");
 //serial.print(year());//this 'works' outputs 1970 indicating time/date functions not reading system time / date.
  serial.print(" ");
serial.print (micros());//this great little way interval timing not need
  // read pressure. parameter 0, 1, 2, or 3 oversampling, see bosch bmp180 datasheet.
  status = bmp180.startpressure(3);
  if (status != 0) {
    delay(status);
    status = bmp180.getpressure(pressure,temp);
    if (status != 0) {
      // submit intergers rather floats because
      // sprintf doesn't support floats without using tricks.
      // easy divide 10000 on receivers side
      // floats.
      pressure = 10000 * pressure;
      sprintf(buf, ",%lu \n", (unsigned long)pressure);
      serial.write(buf);


reboot
bmp180 init success v1
t18455;1446316592, 13428,9108736
1446316592, 41748,9108224
1446316592, 70084,9108151
1446316592, 98420,9108443
1446316592, 126748,9108224
1446316592, 155120,9107053
1446316592, 183492,9106907
1446316592, 211868,9107382
1446316592, 240256,9106979
1446316592, 268632,9107162
1446316592, 297016,9107016
1446316592, 325388,9106650

if don't call settime , set time, assume starting out @ unix time 0, midnight jan 1, 1970.  there no system time on arduino.  if want time stick between power cycles need add rtc chip project.


Arduino Forum > Using Arduino > Programming Questions > Time and the "now()" function


arduino

Comments