nginx-devel Digest, Vol 38, Issue 2

Lawrence Pit lawrence.pit at
Tue Dec 4 05:57:32 UTC 2012

>> After I finished this patch I checked the 1.3 branch, and noticed it
>> already has an $msec http variable defined. But it's output is with a
>> dot character before the milliseconds part. Why is that?
> http {
>  map $msec $s {
> 	~(?<x>.*)\. $x;
>  }
>  map $msec $ms {
> 	~\.(?<x>.*) $x;
>  }
>  server {
> 	return 200 "msec=$msec usec=${s}${ms}000\n";
>  }
> }
> $ curl http://localhost:8000/
> msec=1354471012.591 usec=1354471012591000

That's cool, impressive. Though ugly ;)  If it needs to do that for 
every request it's relatively expensive compared to what I'd rather do:

    proxy_set_header X-Queue-Start "${msec}000";

Is there any objection to not output the dot character starting from the 
1.3 release?

My reason for not using the dot character is that it seems like an 
arbitrary view concern to me and when the value is not used for logging 
purposes it's most likely to be used for calculations or conversions; in 
which case not having to parse out the dot character makes things 


More information about the nginx-devel mailing list