[master] 1f26a9b doc: be concise about about std.real2integer / std.real2time

Nils Goroll nils.goroll at uplex.de
Tue Mar 13 11:14:08 UTC 2018


commit 1f26a9b5411c2d1368c1f808db75ff8e9f24c2bb
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Mar 13 12:13:22 2018 +0100

    doc: be concise about about std.real2integer / std.real2time

diff --git a/lib/libvmod_std/vmod.vcc b/lib/libvmod_std/vmod.vcc
index fe7fd63..34b6399 100644
--- a/lib/libvmod_std/vmod.vcc
+++ b/lib/libvmod_std/vmod.vcc
@@ -195,16 +195,21 @@ Example
 $Function INT real2integer(REAL r, INT fallback)
 
 Description
-	Converts the real *r* to an integer. If conversion fails,
+	Rounds the real *r* to the nearest integer, but round halfway
+	cases away from zero (see round(3)). If conversion fails,
 	*fallback* will be returned.
 Example
 	set req.http.integer = std.real2integer(1140618699.00, 0);
+	set req.http.posone = real2integer( 0.5, 0);	# =  1.0
+	set req.http.negone = real2integer(-0.5, 0);	# = -1.0
 
 $Function TIME real2time(REAL r, TIME fallback)
 
 Description
-	Converts the real *r* to a time. If conversion fails,
-	*fallback* will be returned.
+	Rounds the real *r* to the nearest integer (see
+	`func_real2integer`_) and returns the corresponding time when
+	interpreted as a unix epoch. If conversion fails, *fallback*
+	will be returned.
 Example
 	set req.http.time = std.real2time(1140618699.00, now);
 


More information about the varnish-commit mailing list