maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] sync-time-now-widget for N900 (https://talk.maemo.org/showthread.php?t=72991)

AapoRantalainen 2011-05-12 10:48

[Announce] sync-time-now-widget for N900
 
1 Attachment(s)
Use case:
You do not want any new daemon running on your system, you are not interested in automatically synchronize your clock.

Instead you want simple button which uses standard NTP-server to sync your clock.


sync-time-now-widget (from extras-devel) is then for you. When installed, you have all the time 'sync-button' on your statusbar-menu. When clicked it checks time from pool.ntp.org (using rdate).


Todo (or not todo. Please just pick any task and send patch to me):
*Button visible only when connected to Internet.
*Message, if rdate fails.
*Message, if success.

nicholes 2011-05-12 11:25

Re: [Announce] sync-time-now-widget for N900
 
i will try when i am home THANKS!

WhiteWolf 2011-05-12 11:59

Re: [Announce] sync-time-now-widget for N900
 
Thanks, Thanks, Thanks, Thanks.

sakya 2011-05-12 12:19

Re: [Announce] sync-time-now-widget for N900
 
I installed it, but it doesn't seem to work.
I click the button (while connected via wifi) and I get no feedback: no error or success message.
Looking at connection with Conky I cannot see any network traffic.

EDIT: Sorry, it works. I didn't notice the "TODO". :)

ndi 2011-05-23 11:51

Re: [Announce] sync-time-now-widget for N900
 
Well, works well. I vote against mesage if success, personally.

Also, I'm trying to debug some power usage in hildon-status-menu. Does your plugin do anything if not pressed? Does it do refresh every show, init, etc? I am somewhat sure phone does an update when started, but can't swear by it.

Anyway, thanks.

AapoRantalainen 2011-05-23 12:05

Re: [Announce] sync-time-now-widget for N900
 
Quote:

Originally Posted by ndi (Post 1013458)
Does your plugin do anything if not pressed? Does it do refresh every show, init, etc?

If something happens automatically it is not intended.

Code it is almost this Example 1.5:
http://wiki.maemo.org/Documentation/...s_Menu_widgets

Here are diff:
http://pastebin.com/6KDNKQsb

shawwawa 2011-05-23 13:27

Re: [Announce] sync-time-now-widget for N900
 
This is really cool and very useful. Thanks a lot. :)

corduroysack 2011-05-23 14:17

Re: [Announce] sync-time-now-widget for N900
 
installed and working :)

WhiteWolf 2011-05-24 11:54

Re: [Announce] sync-time-now-widget for N900
 
Idem: installed and working

Love2Learn 2011-07-12 12:32

Re: [Announce] sync-time-now-widget for N900
 
Hi, I’m new to this site (registered specially to replay this post). i hope I’m at the right place. (i recently bought N900, since i have a future ambition to learn programing. And I figured the Maemo would be nice place to start. But at the moment still a nub.)

i use your sync-time-now at least once a day. (does anyone know why every time i take out or change my battery (at least once a day), my N900 system clock goes back to 01/01/2009 and sets time zone somewhere in America?)

After a small learning curve the program works without problems. however here are some things i noticed and my requests for future improvements (if anyone has the time to implement them)

I leave my phone on during the night and change batteries before i go sleep. Then i quickly do a clock sync and go sleep. It happened many times that may alarm did not go of on time because of problems with sync; her is what i later learned why.....

If i do a sync but Wi-Fi contact is not already established it just doesn't sync without any clear sign that sync was aborted.

It syncs time but doesn’t reset my correct time zone. so even if synced successful, my alarm will not go when expected.

So to make sure i don't forget set time zone i first do this. But if directly sync without first closing the clock application sync fails some time but not always. Strange....

To conclude, here my wish list.
Some sort of prompt, if no internet connection available. Or better jet auto connect to internet?

A very small options menu where you can set your current time zone. (And option to enable 24-hr clock)
Then every time the phone starts up (with or without delay) the app check the set time zone with the system time zone. As soon as it realizes the 2 are out of sync. It automatically syncs, time and resets time zone and enables 24-hr clock (if selected)

i don't know if its possible and how difficult /time consuming it would be to add this. but it would mean that my phone would always be synced whenever necessary without me even having to think about it. It would be perfect....

(This everyday having to sync, together with pidgin not doing what i want, are the shared #1 of biggest N900 announces. so lots of love for the ones addressing this issue)

Anyway let me know what you guys think.

AapoRantalainen 2011-07-12 13:28

Re: [Announce] sync-time-now-widget for N900
 
Thanks Love2Learn for your post.

Maybe sync-time-now-widget is not what you need. There are couple of automatically working time-synchronising applications. Phone has also method for synchronising with cellular network ("update automatically" checkbox).

E.g. install package openntpd and it will start every time when phone boots and keeps time synchronised.


These are on todo-list:
*Button visible only when connected to the Internet.
*Error-Message, if syncing fails.

Love2Learn 2011-07-13 02:45

Re: [Announce] sync-time-now-widget for N900
 
Call me very old fashion of futuristic but I don’t use the Cellular network. (I have Wi-Fi almost all day; home, work, friend & family, favorite restaurants etc.) So I don’t really see the point in paying when I can be reachable for free whole day round. Since I don’t use GSM, I have turned it off. So the “update automatically” probably not an option for me. (but I tested it any way, seems to work but sets wrong timezone)

Thanks for the “openntdp” tip, since I figured that it couldn’t hurt to have both programs I just went ahead and installed it.
At first it seems to do nothing for me. (Maybe it does the startup sync before my Wi-Fi connections is established?) After searching the forums I found that if I do a (open console>type root> type ntpd) it works and updates my time&date, but not my time zone. Furthermore I found people posting bash scripts to do the one-click update without opening console.
I looked everywhere, but did not find any button or menu to set of click anything. So for now my conclusion is that your program is much better (better suites my needs).

Thanks for posting your todo-list. Those are 2 good points, but can I try to persuade you or others to also do something with “Time Zone”?
Having your time & date updated but not your time zone still means wrong time (and some parts of the day it also means wrong date :-) and the whole point of having a sync app is to not have to do it manually.

I did some brainstorming and came up with couple of ways to add time zone to the menu bar without needing additional space or complicated settings menu.

Cut the menu bar in 2 half’s. Keep 1 half for the sync now button. Use other have to “take a time zone snapshot” of current time zone and then display it. In my case after the snapshot it would show a “+8”
or
Use the second half for a button that opens the world map where you can select your time zone
or
Cut the menu bar in 2 half’s. Keep 1 half for the sync now button. Cut other half in 3. use the middle one to display the time zone. For instance “+8” and have on both sites a small button. On the left side a minus button to minus 1 and on the right side a plus button to plus 1.

If not too complicated to implement, I guess the snapshot would be best, since it would also allow to instantaneously also record other time settings like “24hr clock” and exact time zone location(day light saving time).

And of course, what might be most difficult part, find a way to allow the program to remember and use this data on next sync.

Anyway, please let me know if my request sounds interesting, reasonable and do-able? Any change this might be added to the todo-list?

Estel 2011-07-13 02:53

Re: [Announce] sync-time-now-widget for N900
 
Just to let You know - if You insert fresh battery quickly after de-attaching "old" one, N900 won't restart Your time. In fact, its about 2-3 seconds to do that, so it's pretty easy - don't need monkey agility and voodoo tricks.


All times are GMT. The time now is 08:51.

vBulletin® Version 3.8.8