Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 58665 invoked by uid 500); 4 Jul 2001 00:32:02 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 58623 invoked from network); 4 Jul 2001 00:31:58 -0000 Message-ID: <00d501c10420$af9337d0$7f00a8c0@VAIO> From: "David Reid" To: "APR Development List" Subject: Timezones logic... Date: Wed, 4 Jul 2001 01:31:30 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N In the recent discussions about implode/explode time it became obvious that the documentation (such as it is) isn't very clear on why we do things the way we do... This I will attempt to solve by this email. We wrote the apr_implode_time routine to take an exploded time structure (that is an APR only structure) and create a time_t from it. There is no reason why this time_t needs to be in any particular time zone, in fact it's often desirable to be able to choose the time zone. That's what we provide through the apr_explode_time and apr_implode_time functions. Simple example. This is something else on my todo list... Basically allow each vhost on the server (apache) to have a timezone setting given to it. This is then used when generating access log entries from that vhost, though not error_log messages. The process becomes very simple with the functions we have... during the request we get the time by calling (pseudo code) t = apr_time_now(); then when we write out to the access log instead of one line we have... apr_explode_time(&xt, t, vhost->offset); apr_strftime(str, str_size, max_str_size, "fmt", xt); This is quick and easy and makes sense (I hope) to everyone reading it. Yes it is server oriented but then it also works for client apps. Brane's addition of apr_implode_gmt helps with those apps that demand a GMT/UTC time. Now if anyone wants to do something fancy with the time (don't know what that would be) we can always get a time_t from that exploded time using just apr_implode_time, which will give us the correct time, i.e. the time that we've just written into the log. If the time returned by apr_implode_time was different I'd say we had a bug! That's why we have done things the way we have, and hopefully that makes people happier about why. I've written this as I probably won't get time to change the docs anytime soon, so if anyone else wants to then please feel free. david