Jump to content


Photo

Date And Time


This topic has been archived. This means that you cannot reply to this topic.
12 replies to this topic

#1 Whistle Master

Whistle Master
  • Pineapple Moderators
  • Hak5 Ninja

  • PipPipPipPipPipPipPip
  • 769 posts

Posted 26 April 2012 - 10:39 AM

Hi !

I share with you a php script to set the correct date and time for the pineapple. It acts as a ntp client but without installing one such as ntpclient, etc.

It gets UTC time, so you will have to change the following parameter in the code:

// time adjustment
$time_adjustment = 7200;
Download

EDIT
Another fix is proposed by Prox here

in /etc/config/system add the lines:

config 'timeserver'
list 'server' '0.openwrt.pool.ntp.org'
list 'server' '1.openwrt.pool.ntp.org'
list 'server' '2.openwrt.pool.ntp.org'
list 'server' '3.openwrt.pool.ntp.org'

You may also need/want to change line 2 to your local timezone.

option 'timezone' 'UTC'

(Note: timezones are listed here)

Add the command 'date -k' to /etc/rc.local

Info: wiki.openwrt.org/doc/uci/system

Edited by Whistle Master, 27 April 2012 - 12:34 PM.

Paypal: Donate Link
Bitcoin: 
1LvG9XXXUeiHPM5Cq1SzV7LoAQ5Pn63LMe


#2 WatskeBart

WatskeBart
  • Active Members
  • Hak5 Zombie

  • PipPipPipPipPip
  • 202 posts

Posted 26 April 2012 - 11:45 AM

Excellent! Great find and finally correct history files for your modules ;)

//WB

 

Great things are not done by impulse, but by a series of small things brought together.

"Vincent van Gogh"


#3 Whistle Master

Whistle Master
  • Pineapple Moderators
  • Hak5 Ninja

  • PipPipPipPipPipPipPip
  • 769 posts

Posted 26 April 2012 - 12:08 PM

The only thing is that you will have to restart crond if you don't set time before it starts otherwise it won't run anymore until you restart it.

Paypal: Donate Link
Bitcoin: 
1LvG9XXXUeiHPM5Cq1SzV7LoAQ5Pn63LMe


#4 Whistle Master

Whistle Master
  • Pineapple Moderators
  • Hak5 Ninja

  • PipPipPipPipPipPipPip
  • 769 posts

Posted 27 April 2012 - 12:35 PM

Added another fix for date and time by Prox in first post.

Paypal: Donate Link
Bitcoin: 
1LvG9XXXUeiHPM5Cq1SzV7LoAQ5Pn63LMe


#5 WatskeBart

WatskeBart
  • Active Members
  • Hak5 Zombie

  • PipPipPipPipPip
  • 202 posts

Posted 27 April 2012 - 02:02 PM

I'm using the second fix from Prox it's much cleaner and out-of-the-box like.

Seb should implement this in next firmware release ;)

//WB

 

Great things are not done by impulse, but by a series of small things brought together.

"Vincent van Gogh"


#6 Root Ctrl

Root Ctrl
  • Members
  • Newbie

  • 5 posts

Posted 30 April 2012 - 10:32 PM

Thanks will give the second fix a go.

#7 WatskeBart

WatskeBart
  • Active Members
  • Hak5 Zombie

  • PipPipPipPipPip
  • 202 posts

Posted 01 May 2012 - 05:09 AM

Thanks will give the second fix a go.


It will be included in the next firmware release ;)

//WB

 

Great things are not done by impulse, but by a series of small things brought together.

"Vincent van Gogh"


#8 lester

lester
  • Active Members
  • Hak5 Fan ++

  • PipPipPipPip
  • 74 posts

Posted 28 August 2012 - 06:07 PM

What do you mean:


// time adjustment
$time_adjustment = 7200;

is that seconds? minutes? Could you be a bit clearer how this works? When I run it, it shows PDT time which is off by more than two hours from the time in the East Coast.

thank you.

#9 barry99705

barry99705
  • Active Members
  • Hak5 Junkie

  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 2,134 posts

Posted 28 August 2012 - 07:34 PM

What do you mean:


// time adjustment
$time_adjustment = 7200;

is that seconds? minutes? Could you be a bit clearer how this works? When I run it, it shows PDT time which is off by more than two hours from the time in the East Coast.

thank you.

It's minutes. Eastern would be -3000, actually I guess it would be -2400 right now. Stupid daylight savings time....
Encryption is the chicken soup of security,
feel free to apply it if it makes you feel better because it’s not going to make things any worse,
but it may not make things any better either.  
---Peter Gutmann
1JRos2rbs9wKRBMchL9Ahw.png

#10 lester

lester
  • Active Members
  • Hak5 Fan ++

  • PipPipPipPip
  • 74 posts

Posted 28 August 2012 - 10:52 PM

Anyway to make this perform at each restart?

#11 Sebkinne

Sebkinne
  • Root Admin
  • WiFi Pineapple Developer

  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 2,871 posts

Posted 29 August 2012 - 02:23 AM

Anyway to make this perform at each restart?


It does. It is built into the pineapple. As long as it has internet it will get the latest time.

#12 lester

lester
  • Active Members
  • Hak5 Fan ++

  • PipPipPipPip
  • 74 posts

Posted 29 August 2012 - 09:46 AM

You mean your time.php script runs automatically without human intervention at startup? Please tell me how to set that up. Thanks!

#13 Whistle Master

Whistle Master
  • Pineapple Moderators
  • Hak5 Ninja

  • PipPipPipPipPipPipPip
  • 769 posts

Posted 30 August 2012 - 12:38 AM

This script is not needed anymore as Seb added the feature in the firmware.

Paypal: Donate Link
Bitcoin: 
1LvG9XXXUeiHPM5Cq1SzV7LoAQ5Pn63LMe