Jump to content


Photo

Date And Time


  • Please log in to reply
12 replies to this topic

#1 Whistle Master

Whistle Master

    Hak5 Ninja

  • Pineapple Moderators
  • PipPipPipPipPipPipPip
  • 616 posts
  • Gender:Male
  • Location:CH

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.

24302.png
Paypal: Donate Link
Bitcoin: 1LvG9XXXUeiHPM5Cq1SzV7LoAQ5Pn63LMe


#2 WatskeBart

WatskeBart

    Hak5 Zombie

  • Active Members
  • PipPipPipPipPip
  • 193 posts
  • Gender:Male
  • Location:AMS-IX

Posted 26 April 2012 - 11:45 AM

Excellent! Great find and finally correct history files for your modules ;)
Great things are not done by impulse, but by a series of small things brought together.

//WB

#3 Whistle Master

Whistle Master

    Hak5 Ninja

  • Pineapple Moderators
  • PipPipPipPipPipPipPip
  • 616 posts
  • Gender:Male
  • Location:CH

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.

24302.png
Paypal: Donate Link
Bitcoin: 1LvG9XXXUeiHPM5Cq1SzV7LoAQ5Pn63LMe


#4 Whistle Master

Whistle Master

    Hak5 Ninja

  • Pineapple Moderators
  • PipPipPipPipPipPipPip
  • 616 posts
  • Gender:Male
  • Location:CH

Posted 27 April 2012 - 12:35 PM

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

24302.png
Paypal: Donate Link
Bitcoin: 1LvG9XXXUeiHPM5Cq1SzV7LoAQ5Pn63LMe


#5 WatskeBart

WatskeBart

    Hak5 Zombie

  • Active Members
  • PipPipPipPipPip
  • 193 posts
  • Gender:Male
  • Location:AMS-IX

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 ;)
Great things are not done by impulse, but by a series of small things brought together.

//WB

#6 Root Ctrl

Root Ctrl

    Newbie

  • Members
  • 5 posts

Posted 30 April 2012 - 10:32 PM

Thanks will give the second fix a go.

#7 WatskeBart

WatskeBart

    Hak5 Zombie

  • Active Members
  • PipPipPipPipPip
  • 193 posts
  • Gender:Male
  • Location:AMS-IX

Posted 01 May 2012 - 05:09 AM

Thanks will give the second fix a go.


It will be included in the next firmware release ;)
Great things are not done by impulse, but by a series of small things brought together.

//WB

#8 lester

lester

    Hak5 Fan ++

  • Active Members
  • PipPipPipPip
  • 73 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

    Hak5 1337 Fan

  • Active Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,465 posts
  • Gender:Male

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....

The Pineapple Wiki

http://wiki.wifipineapple.com

1JRos2rbs9wKRBMchL9Ahw.png


#10 lester

lester

    Hak5 Fan ++

  • Active Members
  • PipPipPipPip
  • 73 posts

Posted 28 August 2012 - 10:52 PM

Anyway to make this perform at each restart?

#11 Sebkinne

Sebkinne

    WiFi Pineapple Developer

  • Root Admin
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 2,200 posts
  • Gender:Male

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

    Hak5 Fan ++

  • Active Members
  • PipPipPipPip
  • 73 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

    Hak5 Ninja

  • Pineapple Moderators
  • PipPipPipPipPipPipPip
  • 616 posts
  • Gender:Male
  • Location:CH

Posted 30 August 2012 - 12:38 AM

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

24302.png
Paypal: Donate Link
Bitcoin: 1LvG9XXXUeiHPM5Cq1SzV7LoAQ5Pn63LMe





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users