[web-devel] wai-logger

Kazu Yamamoto ( 山本和彦 ) kazu at iij.ad.jp
Fri Aug 19 08:11:40 CEST 2011


> 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

OK. I will try to call the following C code everytime without the date
thread and compare it with the original.


#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);  

More information about the web-devel mailing list