Sync date and time

18 views
Skip to first unread message

Jha

unread,
May 23, 2008, 4:16:08 AM5/23/08
to TiddlyWiki
I want to sync my tiddlywiki's time with server. Can anybody help me
with that.
Any help will be appreciated.
Message has been deleted

FND

unread,
May 23, 2008, 4:32:14 AM5/23/08
to Tiddl...@googlegroups.com
> I want to sync my tiddlywiki's time with server.

Not sure what you mean by that.
When creating or modifying a tiddler, TiddlyWiki simply uses the system
time for the tiddler's created/modified timestamp.


-- F.

Jha

unread,
May 23, 2008, 4:49:58 AM5/23/08
to TiddlyWiki
Tiddler does take the system time, but i want to know if there is a
way using which i can make tiddlyWiki update the time (synced with
time server) before any tiddler is saved. The process flow could be
like this:

1) Edit a tiddler/ create a new tiddler.
2) After the user clicks on "done" to save the tiddler, tiddlyWiki
refers to a ".php" page (which contains current date and time).
3) Tiddler is saved with the time just synced with server. In other
words the time modified/ created is taken from this PHP page which
contains current date and time.
4) When TiddlyWiki file is saved it again syncs the time with server
"php" page.

I don't know if i am clear enough, as i am not too sure about php or
javaScripts.

FND

unread,
May 23, 2008, 5:06:50 AM5/23/08
to Tiddl...@googlegroups.com
> Tiddler does take the system time, but i want to know if there is a
> way using which i can make tiddlyWiki update the time (synced with
> time server) before any tiddler is saved.
> [...]

> After the user clicks on "done" to save the tiddler, tiddlyWiki
> refers to a ".php" page (which contains current date and time).

Not sure what the underlying purpose here is, but I would guess that
server-side adaptations (like ccTiddly) use the respective hosting
server's time rather than the user's local system time:
http://www.tiddlywiki.org/wiki/Server-Side_Solutions


-- F.

Jha

unread,
May 23, 2008, 5:18:43 AM5/23/08
to TiddlyWiki
I am sorry, here is the situation. This would give you a better idea
about what i want tiddlywiki to do.

In my office i have deployed tiddlywiki as a tool as a CMS which is
constantly edited and updated by different users.
Due to our access limitation we do not have much option to go for any
other method of adopting tiddlywiki (single file).
All my team member's system time run in different timezone (because of
our nature of work). Hence there is always a confusion as to who
edited the document last.
We have a internal portal link (a "php" page) which shows all of us
the current/ Standard time.
We do not have admin right to change system time.

Hope this gives you an idea about why i want to sync the time alone
with the PHP page.

FND

unread,
May 23, 2008, 5:50:41 AM5/23/08
to Tiddl...@googlegroups.com
> All my team member's system time run in different timezone (because of
> our nature of work). Hence there is always a confusion as to who
> edited the document last.
> We have a internal portal link (a "php" page) which shows all of us
> the current/ Standard time.

Good point - there should be an option to use UTC for timestamps.
Will bring this up with the dev team, and maybe I can whip up a plugin
for it as well.


-- F.

FND

unread,
May 23, 2008, 1:36:40 PM5/23/08
to Tiddl...@googlegroups.com
> Will bring this up with the dev team, and maybe I can whip up a plugin
> for it as well.

Try adding the following code to a tiddler tagged with "systemConfig":
http://tiddlywiki.pastebin.com/f7f590131
Note that this automatically sets the "use UTC" option to "true" on each
startup.

This change is being considered for inclusion in the core:
http://trac.tiddlywiki.org/ticket/651


-- F.

Message has been deleted
Message has been deleted

FND

unread,
Jun 18, 2008, 2:57:56 AM6/18/08
to Tiddl...@googlegroups.com
> any code or plugin which prompts the members for the "Time offset"

If the operating system is configured correctly, that offset should be
calculated automatically!?

> P.s.: Million thanks to FND for all his help till now. Lets hope that
> the time synchronization gets successfully integrated into TiddlyWiki
> adding to its feature list.

UTC is a tricky issue, because it's easily misunderstood by users.
That's why we're still unsure whether to include this patch in the core.
Does the plugin code I'd posted not work for you?


-- F.

Jha

unread,
Jun 18, 2008, 6:53:33 AM6/18/08
to TiddlyWiki
No, it hasn't . There maybe some mistake on my part. This is what I
did:\

I copied the code and pasted it into a tiddler name SyncTime and
tagged it systemConfig. I saved my TiddlyWiki and reloaded it.

I think this could be because all the system in my company sync their
clock from a unique server dedicated for a particular country (maybe).
If that is the case then the system does not have any ways of finding
what the UTC time is.

So if the team member know that he is woking in a timezone which is
5hrs behinde UTC (or any timezone which can be taken as a standard)
and enter it in the box.

I hope that I am clear in explaining the situation.

One more thing that I wanted to emphasise: Even if this code does not
work in my office, I am sure it will help people who have set their
system using timezone offset. Especially if you have more than one
person working from different places on things like GTD. It will
definitely add value to TiddlyWiki.

Thanks in advance.

FND

unread,
Jun 18, 2008, 7:35:21 AM6/18/08
to Tiddl...@googlegroups.com
> I copied the code and pasted it into a tiddler name SyncTime and
> tagged it systemConfig. I saved my TiddlyWiki and reloaded it.

Sounds about right.

> I think this could be because all the system in my company sync their
> clock from a unique server dedicated for a particular country (maybe).
> If that is the case then the system does not have any ways of finding
> what the UTC time is.

I doubt that server returns the local time as UTC - that'd be really
weird...

Try creating a "systemConfig"-tagged tiddler with the following code:
var offset = (new Date()).getTimezoneOffset();
alert(offset);
That should display the respective timezone offset on startup (in minutes).

> So if the team member know that he is woking in a timezone which is
> 5hrs behinde UTC (or any timezone which can be taken as a standard)
> and enter it in the box.

I guess the Date.prototype.toUTC() function could be adapted to prompt
for offset input - but that wouldn't be a clean/reliable solution...


-- F.

Jha

unread,
Jun 18, 2008, 8:21:34 AM6/18/08
to TiddlyWiki
I tried this code and found that it shows a messagebox with "240"
minutes as offset. My system is in EDT (Eastern Daylingt Time) which
is 4 hrs behind. I figured out that the code is able to show the
difference accurately, but I am unable to find if the difference is to
be added or removed from the actual time showen in the system tray. I
guess if it shows the message as -240 or +240 minutes then it can be
differentiated. Moreover, if this number can be used in my TiddlyWiki
to offset the time automatically then it would be great.

Thank you once again for the code.

Jha

unread,
Jun 19, 2008, 4:48:08 AM6/19/08
to TiddlyWiki
Hi,
I have been trying to figure out what is wrong with the code given by
FND, but couldn't find much (thanks to my limited knowledge in JS).

Just now i found out that the issue was not with his code at all. It
has been working all this time in my tiddlyWiki but I couldn't notice
it because each time I was checking it using the TaskTimerPlugin
(http://www.TiddlyTools.com/#TaskTimerPlugin). I as still getting the
system time displayed. Only when I hovered the pointer over a recently
edited tiddler did I notice that the modified time has been offset to
GMT (UTC).

The plugin seems to be taking the system time directly and does not
consider this offset time. Any suggestions will be of great help.
> > -- F.- Hide quoted text -
>
> - Show quoted text -

FND

unread,
Jun 19, 2008, 5:13:12 AM6/19/08
to Tiddl...@googlegroups.com
> Just now i found out that the issue was not with his code at all. It
> has been working all this time in my tiddlyWiki

Glad to hear that - I was really puzzled for a while...

> I was checking it using the TaskTimerPlugin [...]


> The plugin seems to be taking the system time directly and does not
> consider this offset time. Any suggestions will be of great help.

Well, Eric could update the date initializations in his plugin to
support the chkUseUTC option suggested in the core ticket*.
However, I'm not sure whether this makes sense until UTC support
actually makes it into the core. Let's wait for his response (you might
need to start a dedicated thread to capture his attention - but wait a
few days first).

(Dev note: Maybe it would make sense to introduce a getCurrentDateTime()
function for future-proof encapsulation of date initializations.)


-- F.


* http://trac.tiddlywiki.org/ticket/651

Jha

unread,
Jun 19, 2008, 5:35:26 AM6/19/08
to TiddlyWiki

> Well, Eric could update the date initializations in his plugin to
> support the chkUseUTC option suggested in the core ticket*.
> However, I'm not sure whether this makes sense until UTC support
> actually makes it into the core. Let's wait for his response (you might
> need to start a dedicated thread to capture his attention - but wait a
> few days first).

Thank you and I will wait for the time it is included in the core
code. FND has been of great help. Thanks a lot once again.

Reply all
Reply to author
Forward
0 new messages