|
|
1.1 ! root 1: ! 2: ! 3: asctime() Time Function asctime() ! 4: ! 5: ! 6: ! 7: ! 8: Convert time structure to ASCII string ! 9: ! 10: #include <time.h> ! 11: #iinncclluuddee <ssyyss/ttyyppeess.hh> ! 12: cchhaarr *aassccttiimmee(_t_m_p) ttmm *_t_m_p; ! 13: ! 14: asctime takes the data found in tmp, and turns it into an ASCII ! 15: string. tmp is of the type tm, which is a structure defined in ! 16: the header file time.h. This structure must first be initialized ! 17: by either gmtime or localtime before it can be used by asctime. ! 18: For a further discussion of tm, see the entry for time. ! 19: ! 20: asctime returns a pointer to where it writes the text string it ! 21: creates. ! 22: ! 23: ***** Example ***** ! 24: ! 25: The following example demonstrates the functions asctime, ctime, ! 26: gmtime, localtime, and time, and shows the effect of the environ- ! 27: mental variable TIMEZONE. For a discussion of the variable ! 28: time_t, see the entry for time. ! 29: ! 30: ! 31: #include <time.h> ! 32: #include <types.h> ! 33: main() ! 34: { ! 35: time_t timenumber; ! 36: tm *timestruct; ! 37: ! 38: ! 39: ! 40: /* read system time, print using ctime */ ! 41: time(&timenumber); ! 42: printf("%s", ctime(&timenumber)); ! 43: ! 44: ! 45: ! 46: /* use gmtime to fill tm, print with asctime */ ! 47: timestruct = gmtime(&timenumber); ! 48: printf("%s", asctime(timestruct)); ! 49: ! 50: ! 51: ! 52: /* use localtime to fill tm, print with asctime */ ! 53: timestruct = localtime(&timenumber); ! 54: printf("%s", asctime(timestruct)); ! 55: } ! 56: ! 57: ! 58: ***** See Also ***** ! 59: ! 60: time ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66: ! 67: ! 68: ! 69: asctime() Time Function asctime() ! 70: ! 71: ! 72: ! 73: ***** Notes ***** ! 74: ! 75: asctime returns a pointer to a statically allocated data area ! 76: that is overwritten by successive calls. ! 77: ! 78: ! 79: ! 80: ! 81: ! 82: ! 83: ! 84: ! 85: ! 86: ! 87: ! 88: ! 89: ! 90: ! 91: ! 92: ! 93: ! 94: ! 95: ! 96: ! 97: ! 98: ! 99: ! 100: ! 101: ! 102: ! 103: ! 104: ! 105: ! 106: ! 107: ! 108: ! 109: ! 110: ! 111: ! 112: ! 113: ! 114: ! 115: ! 116: ! 117: ! 118: ! 119: ! 120: ! 121: ! 122: ! 123: ! 124: ! 125: ! 126: ! 127: ! 128: ! 129: ! 130: COHERENT Lexicon Page 2 ! 131: ! 132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.