ASPEN_GetServerTime

 

Related Topics

 

 

Purpose

Get a Server's absolute time reference.

 

 

Call Syntax

#include <aspen.h>

AspenRequest(GLOBAL_session, ASPEN_GetServerTime, NULL, &serverTime);

 

 

Parameters

Input

None.

 

Output

The output parameter for this service is a pointer to a ASPEN_GETSERVERTIME_OUTPUT structure that receives the Aspen Server's current time information.

 

 

Structures

typedef struct

{

   ASPEN_TIME minutes;

   int seconds;

}ASPEN_GETSERVERTIME_OUTPUT;

 

 

Remarks

ASPEN_GetServerTime returns the absolute time of the server. This value is important for temporally orienting service requests like ASPEN_GetTickHistory and ASPEN_PutTick.

 

The client computer’s time can be different than the Server’s time—that is, the time zone in which the Server is collecting data can differ from the time zone in which the server is located.

 

For example, suppose a Server located in the Pacific Time zone is collecting stock data in Eastern Time. If at 8:00 a.m. Pacific Time an API application requests data on a NYSE stock from 7:30 a.m. (Pacific Time), the server will return nothing because the NYSE has not opened. If the application requests data from 9:30 a.m., the service will return data from the open.

 

ASPEN_GetServerTime requests provide you a means of orienting a client application to the Server's time. For additional information about the Server, including the time zone in which a Server is collecting data, use the ASPEN_GetServerInfo service.

 

 

Return Value

ASPEN_OK

Server time information returned successfully.

 

 

See Also

Time Values

ASPEN_TIME

AspenRequest()

ASPEN_GETSERVERTIME_OUTPUT

ASPEN_GetServerInfo

 

 

Example

int CAspenRequestDlg::DoASPEN_GetServerTime()

{

   int                        retval;

   struct tm                  localTime;

   char                       timeStr[80];

   server_list                *slp = list;

   ASPEN_GETSERVERTIME_OUTPUT serverTime;

   int                        serverTimeZone=0;

   CString                    strText;

   retval = AspenRequest(

            slp->server_session,

            ASPEN_GetServerTime,

            NULL,

            &serverTime);

   if (!retval)

   {

      AspenTimeToANSITime(

            serverTime.minutes,

            serverTime.seconds,

            serverTimeZone,

            &localTime, NULL);

      strcpy(timeStr, asctime(&localTime));

      strText.Format("Time: %s", timeStr);

      m_HistoryEdit.AppendString(strText);

   }

   return retval;

}

 

©2006 Aspen Research Group, Ltd. All rights reserved. Terms of Use.