Re: value for TODAY
Posted in 1997
Cosmo Lee wrote: > Hari Muthuswamy wrote: > > Where does Informix gets the current date. Does it get from the > > Operating System? > > For example, > > from DBACCESS, when I run a statement like > > 'Select * from today' where does Informix get the date for > > 'today' > > from. > I think your syntax is a bit off here. In the example you gave, you're > trying to select values from a table named "today", not get the value of > this day's date. Usually the date would come from or thru the OS > somehow. I suppose one could write some low-level calls directly to > the hardware, but I'm not sure what one would gain from not using a > function already provided by the OS. Although there IS that parameter > in Online where one choses not to use the OS time - not sure what that's > about. Indeed the syntax is incorrect. Try 'select today from tabname'. The OnLine server obtains the date/time from the operating system, typically by a 'gettimeofday' or 'ftime' call. The USEOSTIME parameter in the onconfig file works as follows: If USEOSTIME is set (=1), *every* reference to the current date/time will cause the server to request the current date/time from the operating system. This means that time returned by SQL statements is accurate typically to the nearest millisecond (on most platforms). If *many* SQL sessions are making *lots* of time related calls, this can have a measurable impact on server performance (gettimeofday is a moderately expensive call). If USEOSTIME is not set (=0), the server requests the date/time from the O/S every second and stores the value in an internal location. SQL requests for date/time are satisfied from this buffer. This means that time reyurned by SQL statements is only accurate to the nearest second. If *many* SQL sessions are making *lots* of time related calls, this can make a small improvement in server performance. -- ------------------------------------------------------------ Chris Jenkins, Advanced Technology Group, Informix Software Standard disclaimers apply