The following example contains a function (SetActivateTime) that sets a SCALAR_TIME scalar (Activate time) for a job folder (F_INSTALLJOB, F_SRVINSTALL, or F_REMPKGJOB):
// Function to set the Activate time scalar for a new job folder.
SMS_STATUS SetActivateTime(HANDLE hFolder, // Handle to job folder.
time_t time // Scalar value.
)
{
SMS_STATUS stat;
SCALAR sc;
char *pszTime;
sc.pszName = "Activate time"; // Name of the scalar to set.
sc.scType = SCALAR_TIME; // Data type of scalar.
sc.tValue = time;
// Use SmsSetScalar to use the sc struct to set the
// scalar for the folder.
stat = SmsSetScalar( hFolder, // Handle to folder containing
// the scalar to set.
&sc // Pointer to SCALAR struct
// containing value to set.
);
if (stat == SMS_OK) {
pszTime = ctime( &sc.tValue );
printf("Activate time %s scalar set successfully.\n", pszTime);
}
else {
printf("Activate time scalar could not be set.\n");
printf("SmsSetScalar error: %d.\n", stat);
}
return stat;
}