☞ strtol, strtoul, strtoll, strtoull, atol, atoi, atoll int setitimer(int which, const struct itimerval *new, struct itimerval *old); int getitimer(int which, struct itimerval *old); unsigned int alarm(unsigned int seconds); unsigned int sleep(unsigned int seconds); sleep() 함수는 진행중인 프로세스를 명시적으로 seconds 초 동안 대기 시킬 때 사용합니다. 입력을 기다리거나 소켓 연결을 기다리는 등의 작업은 select()를 사용하는 것이 효과적입니다. setitimer()와 alarm(..
☞ strptime, getdate char *strptime(const char *s, const char *fmt, struct tm *tp); struct tm *getdate(const char *str); 다양한 형식을 가진 일자 및 시간 스트링을 구조체 struct tm 형태의 일시 정보로 변환하는 함수들로 strptime()은 분석 대상인 문자열 s와 형식 문자열 fmt를 인수로 전달하면서 결과를 받을 struct tm 구조체의 포인터를 같이 넘기면 문자열을 분석하여 일자 및 시간 정보를 해당 포인터가 가리키는 구조체에 저장합니다. getdate()는 분석 대상 문자열만 인수로 전달하는 간편한 방식이기는 하지만 분석 방식에 한계가 있고 리턴하는 포인터가 시스템 메모리이기 때문에 연관 함수가 ..
☞ asctime, ctime, strftime char *asctime(const struct tm *time); char *ctime(const time_t *time); size_t strftime(char *s, size_t size, const char *template, const struct tm *time); asctime()은 struct tm 구조체의 포인터, ctime()은 time_t의 포인터를 입력으로 일시를 나타내는 표준 형식의 문자열을 리턴합니다. 표준 형식은 "Fri Jun 22 16:59:00 2018\n"와 같습니다. 이 두 함수는 시스템 메모리의 문자열 포인터를 리턴하므로 일자 관련 함수를 호출하면 이전 메모리의 내용은 지워질 수 있습니다. 멀티 쓰레드 프로세스등에서는 ..
☞ time, stime, gettimeofday, settimeofday, adjtime, localtime, gmtime, mktime time_t time(time_t *result); int stime(const time_t *newtime); int gettimeofday(struct timeval *tp, struct timezone *tz); int settimeofday(const struct timeval *tp, const struct timezone *tz); int adjtime(const struct timeval *delta, struct timeval *olddelta); struct tm *localtime(const time_t *time); struct tm *gmtime..
☞ difftime, clock, times double difftime(time_t time1, time_t time0); clock_t clock(void); clock_t times(struct tms *buffer); 통상 time_t 타입의 0 값은 "1970-01-01 00:00:00"를 의미하고 시스템에 따라 다르지만 time_t의 크기가 8바이트인 경우는 2038년까지 표현할 수 있습니다. 그래서 두 시간 사이의 차이를 단순히 time0-time1과 같이 구할 수도 있지만 시스템에 따라 예상치 않은 결과를 초래할 수도 있습니다. time0에서 time1까지의 시간 차이는 difftime()으로 초단위로 구할 수 있습니다. ☞ 예제1 ...... if (old_transactions_proc..
☞ strtod, strtof, strtold, atof, ecvt, fcvt, gcvt double strtod(const char *str, char **tailptr); float strtof(const char *str, char **tailptr); long double strtold(const char *str, char **tailptr); double atof(const char *str); char *ecvt(double value, int ndigit, int *decpt, int *neg); char *fcvt(double value, int ndigit, int *decpt, int *neg); char *gcvt(double value, int ndigit, char *buf); ..
☞ strtol, strtoul, strtoll, strtoull, atoi, atol, atoll long int strtol(const char *str, char **tailptr, int base); unsigned long int strtoul(const char *str, char **tailptr, int base); long long int strtoll(const char *str, char **tailptr, int base); unsigned long long int strtoull(const char *str, char **tailptr, int base); int atoi(const char *str); long int atol(const char *str); long long i..
☞ abs, fabs, frexp, ldexp, ceil, floor, trunc, round, modf, fmod, remainder int abs(int number); long int labs(long int number); long long int llabs(long long int number); double fabs(double number); float fabsf(float number); long double fabsl(long double number); double frexp(double value, int *exponent); float frexpf(float value, int *exponent); long double frexpl(long double value, int *expone..