tf_set_date_time(), sf_set_date_time()

Purpose

Sets the current date and time

Old name

#define _set_date tf_set_date_time

Syntax (DP4DBAPI)

void tf_set_date_time(const datetype *date,const timetype * time)

Syntax (DP4DBAPI)

BOOLEAN dp4_sf_set_date_time(CONN *conn, const datetype * date, const timetype * time);

Parameters

CONN * conn

Handle to a DP4DBAPI connection, obtained by an earlier call to dp4_srv_connect()

 

const datetype* date

Pointer to a variable to holding the new current date

 

const timetype* time

Pointer to a variable to holding the new current time

Description

The tf_set_date_time() and sf_set_date_time() functions (attempt to) change the operating system's current date and time to that specified in the parameters.

Note that these functions do not work in all environments. For example, they fail on Novell because there is no way to set the date and time in this operating system. For the DP4DABPI version of the API, the return value indicates that the function completed without encountering an error from DP4. This does not necessarily indicate that the time was successfully changed.

See also

tf_get_date_time()

Example

/*
 C Functions Reference Manual
 ----------------------------
 Filename: TF_SET_D.C
 Example: tf_set_date_time and tf_get_date_time
 Purpose: Simplified version of the DP4 program
          SETDATE
*/

/* #db salesord #c #end */ #include "dp4.h" #include "tf_set_d.h" /* generate this file by running LIBMAKE */
/* variables */ static datetype new_date; /* DP4 datetype record */ static timetype new_time; /* DP4 timetype record */
/* prototypes */ static void edit_date(void); static void data_inner(int,int*);
void process() { tf_get_date_time(&new_date,&new_time); edit_date(); /* and edit it */ } /**/ static void edit_date() { if (!map_get_inputs(1,1,data_inner,RETAIN|PREDISPLAY)) tf_set_date_time(&new_date,&new_time); } /**/ static void data_inner(mapnr, f) int mapnr; int* f; { switch (*f) { case 1: inpm_d(&new_date); break; case 3: inpm_t(&new_time); break; default: inpm_omit(); break; } }