I recently noticed my iphone clock wasn’t accurate. I’m not exactly sure why. It was only a few minutes behind, but it still annoyed me. Why couldn’t my iphone sync its time with an internet time server?? I know it is supposed to sync with my mobile network operator, but I think mine doesn’t sync… Maybe it’s my operator?
For jailbroken iphones, there’s a neat app on cydia called NTPDate. It’s a great app and I recommend installing it. All you need is specify the ntp server, and click ‘set’ and it will sync your clock for you. However, I wanted to go a step further. I wanted my iphone to sync itself automatically for me, using a cron job. Well, not quite using cron, but it can be done automatically.
Here’s a quick step by step:
1. Install NTPDate from cydia.
2. SSH to your iphone and create a shell script in /usr/bin (or SCP it to your iphone), lets call it /usr/bin/time_sync.sh
#!/bin/sh /Applications/NTPdate.app/bin/ntpdate ntp.exnet.com
Notice I used an ntp server in the UK (ntp.exnet.com). You can use any ntp server.
3. Create a new plist file in /Library/LaunchDaemons (or SCP it to your iphone), lets call it /Library/LaunchDaemons/com.test.synctime.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>test.synctime</string> <key>OnDemand</key> <true/> <key>Program</key> <string>/usr/bin/time_sync.sh</string> <key>StartCalendarInterval</key> <dict> <key>Minute</key> <integer>7</integer> </dict> </dict> </plist>
This plist is set to run every hour, at 7 minutes past the hour
4. install the plist file
user1s-iPhone: root# launchctl load /Library/LaunchDaemons/com.test.synctime.plist
I don’t know what happens if your phone’s time is actually ahead, the job might run several times and keep moving the time… Try at your own risk.
Update: I realised as soon as I plugged my iphone to my mac, it synchornised its time with it. Maybe that’s why it was drifting… I left this automatic sync there anyway though.
2 replies on “iphone running late”
Alternatively, you could simply purchase a nice timepiece and wear it on your wrist?
[…] gelesen, dass man das automatisieren kann – bin aus der Anleitung aber nicht ganz schlau geworden: http://blog.gingerlime.com/iphone-running-late Das ich im Dateisystem an 2 verschiedenen Stellen vorher erstellte Dateien platzieren muss habe […]