problems with Datetime

ok, hello

I have been trying to get Datetime working for around a week now, various combinations, and iterations, and as far as i can see i have it right, but it does not seem to be pulling the time properly or updating it, on each loop, i am going to post my code below. And also if i need to set anything special inside linux for it to be able to do it.
Any help would be appreciated.

Thanks

//#include <Messenger.h>
#include <DateTimeStrings.h>
#include <DateTime.h>
#include <SimpleMessageSystem.h>

//Messenger message = Messenger(); // Instantiate Messenger object with the default separator (the space character)

//#define TIME_MSG_LEN 11
//#define TIME_HEADER 255

long answer;
long randnumber;
unsigned long time;
long randnumber2;
long answer2;
long secs;
long interval;

void setup() // run once, when the sketch starts
{
Serial.begin(115200);
}

void loop() // run over and over again
{

//while ( Serial.available() ) { // Check if there is Serial data
//if ( message.process(Serial.read() ) ){ // Process the Serial data and continue if there is a message
// Set the interval
//interval = message.readInt();
//}
//}

//time = 0 ;

time_t pctime = 0 ;
char c = Serial.read();
pctime = c ;
DateTime.sync(c);
DateTime.available();
//digitalClockDisplay();
//getPCtime();
time = DateTime.now();
//Serial.println(DateTime.status(pctime));
//secs = 0;
//time = millis();
Serial.println(“time :”);
Serial.println(time);
//DateTime.available();
randnumber = random (1 , 2000);
randnumber2 = random (2000, 4000);
answer = randnumber * 3;
answer2 = randnumber2 * answer;
Serial.println(“randomnumber 1 - 1/2000:”);
Serial.println(randnumber);
Serial.println(“randomnumber 2 - 2000/4000:”);
Serial.println(randnumber2);
Serial.println("answer1 - randomnumber1 * 3 is : ");
Serial.println(answer);
Serial.println(“answer2 - randomnumber2 * answer1 is :”);
Serial.println(answer2);

if (answer2 <= 1000000)
Serial.println(“answer2 is less than i million. :slight_smile: .”);
else if (answer2 >= 5000000)
Serial.println(“Answer2 is bigger than 5 million. :slight_smile: .”);
else if (answer2 >= 1000000 and answer2 <= 3000000)
Serial.println(“Answer2 is inbetween 1 million and 3 million. :slight_smile: .”);
else if (answer2 >= 3000000 and answer2 <= 5000000)
Serial.println(“Answer2 is inbetween 3 million and 5 million. :slight_smile: .”);

delay(30000);

}

Did you try the example DateTime code, that might be a good place to start. If you want to test it without using the Processing sketch, you can make the following changes to set the time using the Arduino Serial Monitor:

In the example sketch in the playground change :

define TIME_HEADER 255 // Header tag for serial time sync message

to

define TIME_HEADER '#' // Header tag for serial time sync message changed to pound sign

In the IDE, start the serial monitor (keep to 19200 for this test) and past the following into send window:

1242711000

Press send – this should start the clock at 5:30 am today.

Once you have this going it will be easier to explore other ways of getting serial input into your sketch.

Good luck !