Re: getdate() problem: where is the time taken from ?



Matik (marzec@xxxxxxxxxxxx) writes:
there is a program running, which sends information to two other
programs.
This information is a timestamp of the program in datetime format,
which has it's own clock.
The clock is incremented each 5 seconds of the program, which
corespondes to aprox. one second of the real time.
It means, each on second of real time, the computer time is updated +5
seconds.

So you have an application that modifies the computer clock every
second, and now you are asking why:

What I can not UNDERSTAND, why sometimes the time is equal, or
sometimes is ALMOST equal (within the diff of miliseconds), and why
sometimes the time is like this(!!!) :

getdate() = '2007.04.25 10:59:55.000'
prm_recieved = '2007.04.25 10:00:00.000'

getdate() does not always reflect you recently updated system time.

I guess the answer is that there is not really reason that Windows and
SQL Server would behave the way you may want it to in this very special
scenario.

One reason that getdate() apparently lags behind is that getdate() has
a resolution of 3.33 ms which after all is quite a long time in a computer.
Assuming that SQL Server reads the system clock every 3.33 ms, getdate()
could seemingly lag behind your manipulated time.



--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: getdate() problem: where is the time taken from ?
    ... The getdate() is not taking the current system time, ... in different versions of SQL Server, or even in different service packs. ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: evaluating statement within a parameter for stored procedure
    ... exec pr_foo @param = getdate() ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Datatype-convertion in TSQL
    ... convert= getdate() ... stringified floats. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: DB_E_ERRORSINCOMMAND ( HRESULT = -2147217900 )
    ... getDate(), 'Job Created by Guest -- Guest') ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Index View
    ... I also have Ent. ... Indexed views are supported by SQL Server 2000. ... can't use this for your query. ... GETDATE()" prohibits this view from being indexed. ...
    (microsoft.public.sqlserver.programming)