\doxysection{workspace/post-\/scarcity/src/time/psse\+\_\+time.c File Reference}
\hypertarget{psse__time_8c}{}\label{psse__time_8c}\index{workspace/post-\/scarcity/src/time/psse\_time.c@{workspace/post-\/scarcity/src/time/psse\_time.c}}
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$time.\+h$>$}\newline
{\ttfamily \#include $<$wchar.\+h$>$}\newline
{\ttfamily \#include $<$wctype.\+h$>$}\newline
{\ttfamily \#include "{}memory/conspage.\+h"{}}\newline
{\ttfamily \#include "{}memory/consspaceobject.\+h"{}}\newline
{\ttfamily \#include "{}arith/integer.\+h"{}}\newline
{\ttfamily \#include "{}time/psse\+\_\+time.\+h"{}}\newline
Include dependency graph for psse\+\_\+time.\+c\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{psse__time_8c__incl}
\end{center}
\end{figure}
\doxysubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{psse__time_8c_a369266c24eacffb87046522897a570d5}{\+\_\+\+GNU\+\_\+\+SOURCE}}
\item 
\#define \mbox{\hyperlink{psse__time_8c_afedbc7754156f23b86028f925a7c19b1}{seconds\+\_\+per\+\_\+year}}~31557600L
\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} \mbox{\hyperlink{psse__time_8c_a577c1ca3a52e477c2a5cd1e3ac7e0030}{lisp\+\_\+time}} (struct \mbox{\hyperlink{consspaceobject_8h_structstack__frame}{stack\+\_\+frame}} \texorpdfstring{$\ast$}{*}frame, struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} frame\+\_\+pointer, struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} env)
\begin{DoxyCompactList}\small\item\em Function; return a time representation of the first argument in the frame; further arguments are ignored. \end{DoxyCompactList}\item 
long int \mbox{\hyperlink{psse__time_8c_a51ce7b6c694f7a4e972260b9b35bd485}{lisp\+\_\+time\+\_\+to\+\_\+unix\+\_\+time}} (struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} t)
\begin{DoxyCompactList}\small\item\em Return the UNIX time value which represents this time, if it falls within the period representable in UNIX time, or zero otherwise. \end{DoxyCompactList}\item 
struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} \mbox{\hyperlink{psse__time_8c_acdecd05c91cfe78f2f5989101a68123a}{make\+\_\+time}} (struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} integer\+\_\+or\+\_\+nil)
\item 
struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} \mbox{\hyperlink{psse__time_8c_a186e6b6a13bf5f7ba53bbcd1e546f75f}{time\+\_\+to\+\_\+string}} (struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} pointer)
\begin{DoxyCompactList}\small\item\em This is temporary, for bootstrapping. \end{DoxyCompactList}\item 
unsigned \+\_\+\+\_\+int128 \mbox{\hyperlink{psse__time_8c_a06a36fdf3aead5f88fc1da556f4f63cf}{unix\+\_\+time\+\_\+to\+\_\+lisp\+\_\+time}} (time\+\_\+t t)
\end{DoxyCompactItemize}
\doxysubsubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
unsigned \+\_\+\+\_\+int128 \mbox{\hyperlink{psse__time_8c_ad48a548e14fcf5d9badb36ad678147e9}{epoch\+\_\+offset}}
\begin{DoxyCompactList}\small\item\em PSSE Lisp epoch is 14 Bn years, or 441,806,400,000,000,000 seconds, before the UNIX epoch; the value in microseconds will break the C reader. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Macro Definition Documentation}
\Hypertarget{psse__time_8c_a369266c24eacffb87046522897a570d5}\label{psse__time_8c_a369266c24eacffb87046522897a570d5} 
\index{psse\_time.c@{psse\_time.c}!\_GNU\_SOURCE@{\_GNU\_SOURCE}}
\index{\_GNU\_SOURCE@{\_GNU\_SOURCE}!psse\_time.c@{psse\_time.c}}
\doxysubsubsection{\texorpdfstring{\_GNU\_SOURCE}{\_GNU\_SOURCE}}
{\footnotesize\ttfamily \#define \+\_\+\+GNU\+\_\+\+SOURCE}



Definition at line \mbox{\hyperlink{psse__time_8c_source_l00023}{23}} of file \mbox{\hyperlink{psse__time_8c_source}{psse\+\_\+time.\+c}}.

\Hypertarget{psse__time_8c_afedbc7754156f23b86028f925a7c19b1}\label{psse__time_8c_afedbc7754156f23b86028f925a7c19b1} 
\index{psse\_time.c@{psse\_time.c}!seconds\_per\_year@{seconds\_per\_year}}
\index{seconds\_per\_year@{seconds\_per\_year}!psse\_time.c@{psse\_time.c}}
\doxysubsubsection{\texorpdfstring{seconds\_per\_year}{seconds\_per\_year}}
{\footnotesize\ttfamily \#define seconds\+\_\+per\+\_\+year~31557600L}



Definition at line \mbox{\hyperlink{psse__time_8c_source_l00025}{25}} of file \mbox{\hyperlink{psse__time_8c_source}{psse\+\_\+time.\+c}}.



\doxysubsection{Function Documentation}
\Hypertarget{psse__time_8c_a577c1ca3a52e477c2a5cd1e3ac7e0030}\label{psse__time_8c_a577c1ca3a52e477c2a5cd1e3ac7e0030} 
\index{psse\_time.c@{psse\_time.c}!lisp\_time@{lisp\_time}}
\index{lisp\_time@{lisp\_time}!psse\_time.c@{psse\_time.c}}
\doxysubsubsection{\texorpdfstring{lisp\_time()}{lisp\_time()}}
{\footnotesize\ttfamily struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} lisp\+\_\+time (\begin{DoxyParamCaption}\item[{struct \mbox{\hyperlink{consspaceobject_8h_structstack__frame}{stack\+\_\+frame}} \texorpdfstring{$\ast$}{*}}]{frame,  }\item[{struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}}}]{frame\+\_\+pointer,  }\item[{struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}}}]{env }\end{DoxyParamCaption})}



Function; return a time representation of the first argument in the frame; further arguments are ignored. 


\begin{DoxyItemize}
\item (time integer\+\_\+or\+\_\+nil)
\end{DoxyItemize}


\begin{DoxyParams}{Parameters}
{\em frame} & my \doxylink{consspaceobject_8h_structstack__frame}{stack\+\_\+frame}. \\
\hline
{\em frame\+\_\+pointer} & a pointer to my \doxylink{consspaceobject_8h_structstack__frame}{stack\+\_\+frame}. \\
\hline
{\em env} & my environment. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a lisp time; if {\ttfamily integer\+\_\+or\+\_\+nil} is an integer, return a time which is that number of microseconds after the notional big bang; else the current time. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{psse__time_8c_source_l00086}{86}} of file \mbox{\hyperlink{psse__time_8c_source}{psse\+\_\+time.\+c}}.



References \mbox{\hyperlink{psse__time_8c_source_l00059}{make\+\_\+time()}}.



Referenced by \mbox{\hyperlink{init_8c_source_l00206}{main()}}.

\Hypertarget{psse__time_8c_a51ce7b6c694f7a4e972260b9b35bd485}\label{psse__time_8c_a51ce7b6c694f7a4e972260b9b35bd485} 
\index{psse\_time.c@{psse\_time.c}!lisp\_time\_to\_unix\_time@{lisp\_time\_to\_unix\_time}}
\index{lisp\_time\_to\_unix\_time@{lisp\_time\_to\_unix\_time}!psse\_time.c@{psse\_time.c}}
\doxysubsubsection{\texorpdfstring{lisp\_time\_to\_unix\_time()}{lisp\_time\_to\_unix\_time()}}
{\footnotesize\ttfamily long int lisp\+\_\+time\+\_\+to\+\_\+unix\+\_\+time (\begin{DoxyParamCaption}\item[{struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}}}]{t }\end{DoxyParamCaption})}



Return the UNIX time value which represents this time, if it falls within the period representable in UNIX time, or zero otherwise. 



Definition at line \mbox{\hyperlink{psse__time_8c_source_l00039}{39}} of file \mbox{\hyperlink{psse__time_8c_source}{psse\+\_\+time.\+c}}.



References \mbox{\hyperlink{psse__time_8c_source_l00031}{epoch\+\_\+offset}}, \mbox{\hyperlink{consspaceobject_8h_source_l00297}{pointer2cell}}, and \mbox{\hyperlink{consspaceobject_8h_source_l00404}{timep}}.



Referenced by \mbox{\hyperlink{psse__time_8c_source_l00095}{time\+\_\+to\+\_\+string()}}.

\Hypertarget{psse__time_8c_acdecd05c91cfe78f2f5989101a68123a}\label{psse__time_8c_acdecd05c91cfe78f2f5989101a68123a} 
\index{psse\_time.c@{psse\_time.c}!make\_time@{make\_time}}
\index{make\_time@{make\_time}!psse\_time.c@{psse\_time.c}}
\doxysubsubsection{\texorpdfstring{make\_time()}{make\_time()}}
{\footnotesize\ttfamily struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} make\+\_\+time (\begin{DoxyParamCaption}\item[{struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}}}]{integer\+\_\+or\+\_\+nil }\end{DoxyParamCaption})}



Definition at line \mbox{\hyperlink{psse__time_8c_source_l00059}{59}} of file \mbox{\hyperlink{psse__time_8c_source}{psse\+\_\+time.\+c}}.



References \mbox{\hyperlink{conspage_8c_source_l00222}{allocate\+\_\+cell()}}, \mbox{\hyperlink{consspaceobject_8h_source_l00353}{integerp}}, \mbox{\hyperlink{consspaceobject_8h_a259b3afe36776f8ba8498fdf95904f25}{cons\+\_\+space\+\_\+object\+::payload}}, \mbox{\hyperlink{consspaceobject_8h_source_l00297}{pointer2cell}}, \mbox{\hyperlink{consspaceobject_8h_source_l00241}{TIMETV}}, and \mbox{\hyperlink{psse__time_8c_source_l00053}{unix\+\_\+time\+\_\+to\+\_\+lisp\+\_\+time()}}.



Referenced by \mbox{\hyperlink{psse__time_8c_source_l00086}{lisp\+\_\+time()}}.

\Hypertarget{psse__time_8c_a186e6b6a13bf5f7ba53bbcd1e546f75f}\label{psse__time_8c_a186e6b6a13bf5f7ba53bbcd1e546f75f} 
\index{psse\_time.c@{psse\_time.c}!time\_to\_string@{time\_to\_string}}
\index{time\_to\_string@{time\_to\_string}!psse\_time.c@{psse\_time.c}}
\doxysubsubsection{\texorpdfstring{time\_to\_string()}{time\_to\_string()}}
{\footnotesize\ttfamily struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}} time\+\_\+to\+\_\+string (\begin{DoxyParamCaption}\item[{struct \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\+\_\+pointer}}}]{pointer }\end{DoxyParamCaption})}



This is temporary, for bootstrapping. 



Definition at line \mbox{\hyperlink{psse__time_8c_source_l00095}{95}} of file \mbox{\hyperlink{psse__time_8c_source}{psse\+\_\+time.\+c}}.



References \mbox{\hyperlink{consspaceobject_8c_source_l00454}{c\+\_\+string\+\_\+to\+\_\+lisp\+\_\+string()}}, \mbox{\hyperlink{psse__time_8c_source_l00039}{lisp\+\_\+time\+\_\+to\+\_\+unix\+\_\+time()}}, and \mbox{\hyperlink{consspaceobject_8h_source_l00277}{NIL}}.



Referenced by \mbox{\hyperlink{print_8c_source_l00151}{print()}}.

\Hypertarget{psse__time_8c_a06a36fdf3aead5f88fc1da556f4f63cf}\label{psse__time_8c_a06a36fdf3aead5f88fc1da556f4f63cf} 
\index{psse\_time.c@{psse\_time.c}!unix\_time\_to\_lisp\_time@{unix\_time\_to\_lisp\_time}}
\index{unix\_time\_to\_lisp\_time@{unix\_time\_to\_lisp\_time}!psse\_time.c@{psse\_time.c}}
\doxysubsubsection{\texorpdfstring{unix\_time\_to\_lisp\_time()}{unix\_time\_to\_lisp\_time()}}
{\footnotesize\ttfamily unsigned \+\_\+\+\_\+int128 unix\+\_\+time\+\_\+to\+\_\+lisp\+\_\+time (\begin{DoxyParamCaption}\item[{time\+\_\+t}]{t }\end{DoxyParamCaption})}



Definition at line \mbox{\hyperlink{psse__time_8c_source_l00053}{53}} of file \mbox{\hyperlink{psse__time_8c_source}{psse\+\_\+time.\+c}}.



References \mbox{\hyperlink{psse__time_8c_source_l00031}{epoch\+\_\+offset}}.



Referenced by \mbox{\hyperlink{psse__time_8c_source_l00059}{make\+\_\+time()}}.



\doxysubsection{Variable Documentation}
\Hypertarget{psse__time_8c_ad48a548e14fcf5d9badb36ad678147e9}\label{psse__time_8c_ad48a548e14fcf5d9badb36ad678147e9} 
\index{psse\_time.c@{psse\_time.c}!epoch\_offset@{epoch\_offset}}
\index{epoch\_offset@{epoch\_offset}!psse\_time.c@{psse\_time.c}}
\doxysubsubsection{\texorpdfstring{epoch\_offset}{epoch\_offset}}
{\footnotesize\ttfamily unsigned \+\_\+\+\_\+int128 epoch\+\_\+offset}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{=}
\DoxyCodeLine{\ \ \ \ (\ (\ \_\_int128\ )\ (\ \mbox{\hyperlink{psse__time_8c_afedbc7754156f23b86028f925a7c19b1}{seconds\_per\_year}}\ *\ 1000000000L\ )\ *}
\DoxyCodeLine{\ \ \ \ \ \ (\ \_\_int128\ )\ (\ 14L\ *\ 1000000000L\ )\ )}

\end{DoxyCode}


PSSE Lisp epoch is 14 Bn years, or 441,806,400,000,000,000 seconds, before the UNIX epoch; the value in microseconds will break the C reader. 



Definition at line \mbox{\hyperlink{psse__time_8c_source_l00031}{31}} of file \mbox{\hyperlink{psse__time_8c_source}{psse\+\_\+time.\+c}}.



Referenced by \mbox{\hyperlink{psse__time_8c_source_l00039}{lisp\+\_\+time\+\_\+to\+\_\+unix\+\_\+time()}}, and \mbox{\hyperlink{psse__time_8c_source_l00053}{unix\+\_\+time\+\_\+to\+\_\+lisp\+\_\+time()}}.

