R/as.lt.R

`as.lt` <-
function (x,...) 
{
	if (inherits(x,"gmt"))
	{
		d = as.numeric(as.POSIXct(format(Sys.time(),tz="GMT"))-as.POSIXct(format(Sys.time(),tz="")));
		res = x-d;
		res = res %% 24;

		res[x == Inf] = Inf;
		res[x == -Inf] = -Inf;

		class(res)=c("lt","time");
		return(res);
	}
	else	if (inherits(x,"rst")) {
		res = x;
		res$rise=as.lt(x$rise,...);
		res$transit=as.lt(x$transit,...);
		res$set=as.lt(x$set,...);
		return(res);
	}
	else if (inherits(x,"lst")) 
		return(as.lt(as.gmt(x,...),...))
      else
        {
                res = as.vector(x);
                class(res) = c("lt","time");
                return(res);
        }  
}

Try the moonsun package in your browser

Any scripts or data that you put into this service are public.

moonsun documentation built on May 29, 2017, 12:17 p.m.