Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
 
Returns the current local time and date in various formats.
The current local time and date is provided by the EDMserver to facilitate a synchronous time and date for all EDMserver clients.
Related functions: edmiStringToDate , edmiPackDate , edmiUnpackDate , edmiGetPackedDate .
Header:
#include "sdai.h"
Prototype:
EdmiError edmiGetLocalDate(EdmiPackedDate *packedDate,
                            EdmiDate       *date, 
                            EdmiStringDate *stringDate, 
                            SdaiInteger    stringFormat);
Arguments:

packedDate

Address of a variable that will receive the current local time and date in an EdmiPackedDate format. Dates from January 1st, 1990 to December 31st, 2053 can be represented in this format. Use edmiUnpackDate to convert the packed date into a readable format.
 

date

Address of a data structure that will receive the current local time and date in EdmiDate format. The actual data is located in a buffer in EDMinterface that can be overwritten in the next EDMinterface call.
The datatype EdmiDate is a structure comprising nine longs holding the following values;
second : [0-59] 
minute : [0-59]  
hour : [0-23] 
day : [1-31] 
month : [1-12] 
year : [1990-2053]  
weekday: [0:Sunday, 1:Monday, … 6:Saturday] 
dayOfYear ; [1-366] Not yet implemented. 
DaylightSavingTime: Not yet implemented. 
 

stringDate

Address of a variable that will receive the current local time and date in a readable string format. The actual string is located in a buffer in EDMinterface that may be overwritten by the next EDMinterface call. If you need to preserve this string, use strcpy to create a copy.
NOTE: Do not use edmFree to release this memory.

stringFormat

Dummy. Not yet used.

Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an EDMinterface error code. Use edmiGetErrorText to get the error text corresponding to the error code.
EXAMPLE
EdmiError rstat;
EdmiPackedDate packedDate;
EdmiStringDate stringDate;
EdmiDate date;
. . .
if (rstat = edmiGetLocalDate(&packedDate, &date, &strDate, 0)) {
printf("\nError %d in edmiGetLocalDate: %s", rstat,  
edmiGetErrorText(rstat)); 
goto error; 
}
printf("\nTime: %02d:%02d:%02d", date.hour, date.minute, date.second);
printf("\nDate: %02d/%02d/%04d", date.day, date.month, date.year);
printf("\nString Formatted Date: %s", strDate);
printf("\nPacked Date: %lu", packedDate);

  • No labels