SNMP Subagent Programmer's Guide
Writing Subagent Logic
SNMP Subagent Programmer’s Guide—119728 4-31
Callback Functions
The Get access function for this subagent uses three C library functions (time, localtime, 
and strftime) to determine and format the current system time:
static int
GET_systemTimeString(void *ctxt, void **indices, void *attr_ref)
{
 OCTETSTRING *attr;
 time_t now;
 struct tm *curtime;
 now = time(NULL);
 curtime = localtime(&now);
 systemTimeString.len = (Len_t) strftime (systemTimeString.val,
 20, "%Y/%m/%d %H:%M:%S",
 curtime);
 attr = (OCTETSTRING *) attr_ref;
 *attr = systemTimeString;
 return(SNMP_ERR_NO_ERROR);
}










