[web-devel] wai-logger

Michael Snoyman michael at snoyman.com
Fri Aug 19 08:13:41 CEST 2011

Actually, the idea we'd been passing around was having an IORef with
both the rendered time and the integral time. Whenever the rendered
time is requested, we first compare the stored integral time with the
current time. Only if there's a mismatch would we generate a new
rendered time.

On Fri, Aug 19, 2011 at 9:11 AM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
> Hello,
>> For 1), The previous discussion just concluded that the time to fetch the date
>> is very small. The advantage of always fetching the date is that you can
>> remove the need for a separate date thread [1]. I always think of delays as a
>> code smell and look for other ways of doing things. In this case the docs
>> state:
> The real problem is that the logging date fromat is *a zone time*.  It
> is a tough job to implement due to a time zone. Data.Time can produce
> it but it is too slow for our purpose. This is why wai-logger uses
> Data.Time just once every second.
> I looked the code of snap-core and it fixes this problem using C's
> strftime.
> OK. I will try to call the following C code everytime without the date
> thread and compare it with the original.
> --Kazu
> #include <time.h>
> #include <stdio.h>
> main () {
>  time_t timer;
>  struct tm *date;
>  char str[40];
>  timer = time(NULL);
>  date = localtime(&timer);
>  strftime(str, 40, "%d/%b/%Y:%H:%M:%S %z", date);
>  printf("%s\n", str);
> }
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel

More information about the web-devel mailing list