DateTime library problem [solved]

Hi,
I tried to install the DateTime library. But when I try to run it, I get the error message:
22: error: DateTime.h: No such file or directory In function 'void getPCtime()':
In function 'void digitalClockDisplay()':

I am running arduino16 on mac osx 10.5.8
I downloaded the datetime.zip with the library folders etc. and I extracted it in /Applications/arduino-0016/hardware/libraries
I restarted arduino software, and the library DOES show up in Sketch>Import Library (which is how I included it)
What am I doing wrong? Sorry if this is totally trivial! I couldn't find anyone else having this problem. Thanks so much!

#include <DateTime.h>

#include <DateTimeStrings.h>


#define TIME_MSG_LEN  11   // time sync to PC is HEADER and unix time_t as ten ascii digits
#define TIME_HEADER  255   // Header tag for serial time sync message

void setup(){
  Serial.begin(19200); 
}

void  loop(){  
  getPCtime();   // try to get time sync from pc        
  if(DateTime.available()) { // update clocks if time has been synced
    unsigned long prevtime = DateTime.now(); 
    while( prevtime == DateTime.now() )  // wait for the second to rollover
      ;
    DateTime.available(); //refresh the Date and time properties
    digitalClockDisplay( );   // update digital clock

    // send our time to an app listening on the serial port
    Serial.print( TIME_HEADER,BYTE); // this is the header for the current time
    Serial.println(DateTime.now());      
  } 
}

void getPCtime() {
  // if time available from serial port, sync the DateTime library
  while(Serial.available() >=  TIME_MSG_LEN ){  // time message
    if( Serial.read() == TIME_HEADER ) {        
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){   
        char c= Serial.read();          
        if( c >= '0' && c <= '9')   
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number            
      }   
      DateTime.sync(pctime);   // Sync DateTime clock to the time received on the serial port
    }  
  }
}

void digitalClockDisplay(){
  // digital clock display of current time
  Serial.print(DateTime.Hour,DEC);  
  printDigits(DateTime.Minute);  
  printDigits(DateTime.Second); 
  Serial.print(" "); 
  Serial.print(DateTimeStrings.dayStr(DateTime.DayofWeek));
  Serial.print(" ");  
  Serial.print(DateTimeStrings.monthStr(DateTime.Month));  
  Serial.print(" ");
  Serial.println(DateTime.Day, DEC);   
}

void printDigits(byte digits){
  // utility function for digital clock display: prints colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits,DEC);   
}

Can you confirm that the directory : /Applications/arduino-0016/hardware/libraries/DateTime has the following files:
DateTime.c
DateTime.h
DateTime.o

I moved the files

DateTime.c
DateTime.h

to /Applications/arduino-0016/hardware/libraries/DateTime

from

/Applications/arduino-0016/hardware/libraries/DateTime/DateTime

and it worked plus it generated DateTime.o

When I run it though, it says: "0:00:00 Sunday January 0" Ideas why it is not sync'ing?
The time does not actually increment it just says 0:00:00 all the time

:frowning:

are you using the processing application to sync?

THANK YOU !

I have tried to upload the DateTime code from the Libraries and I keep getting 22 error, the DateTime.h, getPCtime();, DateTime.available(); are not found in function with void loop(). Can someone help me with this problem.

Ensure you have installed the library in the correct directory:
See: http://www.arduino.cc/en/Reference/Libraries

There is a newer library called Time that is based on DateTime but is a little easier to use. You can download that library here: Arduino Playground - Time