Difference between revisions of "Public.getpercentavailabilityinwindow (function)"
Line 1: | Line 1: | ||
== wikibot == | == wikibot == | ||
+ | |||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- | ||
+ | | '''Function | ||
+ | | public.getpercentavailabilityinwindow | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | |||
+ | === Source === | ||
+ | <pre> | ||
CREATE OR REPLACE FUNCTION public.getpercentavailabilityinwindow(integer, character varying, integer, timestamp without time zone, timestamp without time zone) | CREATE OR REPLACE FUNCTION public.getpercentavailabilityinwindow(integer, character varying, integer, timestamp without time zone, timestamp without time zone) | ||
RETURNS double precision | RETURNS double precision | ||
Line 20: | Line 31: | ||
END; | END; | ||
$function$ | $function$ | ||
+ | </pre> | ||
+ | |||
+ | === References === | ||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Dependency Type | ||
+ | | '''Object Type | ||
+ | | '''Referenced Object | ||
+ | |||
|- | |- | ||
| Execute | | Execute | ||
| Function | | Function | ||
| [[public.getoutagetimeinwindow_(function)|public.getoutagetimeinwindow]] | | [[public.getoutagetimeinwindow_(function)|public.getoutagetimeinwindow]] | ||
+ | |||
+ | |} |
Revision as of 08:37, 11 February 2010
wikibot
Function | public.getpercentavailabilityinwindow |
Source
CREATE OR REPLACE FUNCTION public.getpercentavailabilityinwindow(integer, character varying, integer, timestamp without time zone, timestamp without time zone) RETURNS double precision LANGUAGE plpgsql AS $function$ DECLARE nid ALIAS FOR $1; ipid ALIAS FOR $2; sid ALIAS FOR $3; xtime ALIAS FOR $4; ytime ALIAS FOR $5; downtime float8; BEGIN downtime := getOutageTimeInWindow(nid, ipid, sid, xtime, ytime); IF xtime > ytime THEN RETURN 100 * (1 - (downtime / (EXTRACT(EPOCH FROM (xtime - ytime))* 1000))); ELSE RETURN 100 * (1 - (downtime / (EXTRACT(EPOCH FROM (ytime - xtime))* 1000))); END IF; END; $function$
References
Dependency Type | Object Type | Referenced Object |
Execute | Function | public.getoutagetimeinwindow |