function t=Time(n,ET,NS)
% NS and ET are number in system and event times output by function MG1Q
% this gives proportion of time that system has >n customers in it.
% NS is the number in the system just after event times ET. 
m=length(ET);
ET=[ET ET(m)];   % duplicate the last component  of ET 
v=find(NS>n);
t=sum(ET(v+1)-ET(v))/(ET(m)-ET(1));
