ANSITimeToAspenTime()

 

Related Items

 

 

Purpose

Converts time information from the ANSI C library struct tm format to the ASPEN_TIME format used by the Aspen API.

 

 

Syntax

#include "aspen.h"

#include <time.h>

...

void ANSITimeToAspenTime(

   struct tm           localTime,

   int                 timeZone,

   ASPEN_TIME          *absoluteTime);

 

 

Parameters

localTime

localTime is input to the function. It is a pointer to an ANSI struct tm that represents the current time in the time zone where the application is running.

 

timeZone

timeZone is input to the function. It represents the Aspen time zone identifier for the local time zone.

 

A computer’s time can be, and often is, 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 (and, therefore, the time of the Server’s Operating System).

 

*absoluteTime

*absoluteTime points to a variable that will receive an Aspen absolute time value corresponding to the time given by localTime. Aspen absolute time represents the number of minutes since 12:00 a.m., January 1, 1900 at the International Date Line.

 

 

Remarks

If a session is not opened prior to calling this function, default time zone values will be used which may not represent the most accurate information available on the Aspen Server.

 

 

Return Value

NA

 

 

See Also

AspenTimeToANSITime()

ASPEN_TIME

Time Values

Why Aspen Time is Different from ANSI Time

 

 

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.