Antville Project

Saturday, 25. May 2002

Timezone support roundup

Finishing timezone support for Antville was pretty painless - all I had to do was make sure that date parsing and formatting are always done through parseTimestamp() and formatTimestamp() functions, which take in account the local weblog's localisation and timezone, if a weblog object is present in the request path. All dates are still stored in local server time. Both parseTimestamp() and formatTimestamp() are in global now, although weblog.formatTimestamp() is still there for backward compatibility - I didn't want to go through all the code - but all it does now is to forward the call to the global formatTimestamp() function.

The fact that the weblog object for date localization is always taken from the request path (i.e. path.weblog) causes one significant change: If an object from one weblog is used from within a page of another weblog or the application root area, the language and timezone from the embedding environment will be used for rendering dates, not those of the object's home weblog. In my opinion this makes sense because with timezone support, dates would not only be rendered in a strange language, but could also be a few hours off, i.e. you'd see dates in different timezones mixed together in one page. However, if this functionality is needed, it would be possible to format dates according to their home weblog by passing either the weblog or the locale and timezone to the formatTimestamp() function.

Finally, I implemented caching of java.text.SimpleDateFormat objects. These things are pretty expensive to create since the format has to be parsed each time. On the other hand, reuse is difficult because the class is not thread safe and would produce broken output if used by multiple threads at the same time. My solution is to cache them in the res.data object, using the format string such as "short", "yyyyMMdd" etc as key. front page rendering is now about 10% faster, and the gain could be even larger for pages with many dates.

Right now, the changes are still in the hns_timezone branch. I'll test some more and eventually merge changes to the main branch if that's ok.

link (7 comments
 

The Antville Server Fund has been a great success. Thanks to everybody who contributed!
online for 8550 Days
last updated: 1/4/11, 10:22 AM
status
Youre not logged in ... Login
menu
May 2002
SunMonTueWedThuFriSat
1234
567891011
12131415161718
19202122232425
262728293031
AprilJune
recent
zfuture's house here is zfuture's
house
by zfuture (7/31/03, 2:59 AM)
i understand your concerns however,
i hardly can think of a solution. certainly, if the...
by tobi (7/29/03, 9:47 AM)
Found several more similar sites
listed This is getting to be quite a concern to...
by cobalt123 (7/27/03, 7:56 PM)
Second Post Alert on Referrer
bug livecatz I put this into "help" and now here:...
by cobalt123 (7/26/03, 7:14 PM)
well it's not easy to
find from here, anyway. think we should include a link,...
by tobi (7/24/03, 11:25 AM)
So finally I found
the helma Bugzilla - stupid me.
by mdornseif (7/24/03, 10:28 AM)
clock not that it's particularly
earthshattering but the antclock is running slow by about 15...
by kohlehydrat (7/23/03, 8:25 PM)
but blogosphere.us isn't can't really
be rated as spam can it?
by kohlehydrat (7/23/03, 8:08 PM)
More referrer spam www.webfrost.com
by Irene (7/23/03, 7:55 PM)
How to log skin names
I accessed to console?? Hi, I would like to know...
by winson (7/23/03, 4:12 PM)

Click here to get an XML version of this weblog.

Made with Antville
powered by
Helma Object Publisher