리눅스에서 시간과 관련된 함수와 구조체는 무엇이 있습니까?

hyj3535의 이미지

시간과 관련된 그리고 시간을 조작하는 function 과 구조체가 많을꺼 같은데..

어디서 찾아야 될까여?

꼭 알려주세요...답변 기다릴께요.

eungkyu의 이미지

시각을 다루는 각종 함수들의 맨페이지는 다음에서 볼 수 있습니다.
time(2) 함수는 현재 시각을 알아내는 시스템 콜이고, 이것을 기반으로 이렇게 저렇게 다루는 함수들이 많이 있습니다. (ctime(3) 등등)

$ man 2 time
$ man 3 ctime
펑키의 이미지

MAN page에서 대충 몇개만 찾아 본것입니다.

http//man.kldp.org
를 참조해보세요.

struct tm {
int tm_sec; /* seconds */
int tm_min; /* minutes */
int tm_hour; /* hours */
int tm_mday; /* day of the month */
int tm_mon; /* month */
int tm_year; /* year */
int tm_wday; /* day of the week */
int tm_yday; /* day in the year */
int tm_isdst; /* daylight saving time */
};

char *asctime(const struct tm *tm);
char *asctime_r(const struct tm *tm, char *buf);

char *ctime(const time_t *timep);
char *ctime_r(const time_t *timep, char *buf);

struct tm *gmtime(const time_t *timep);
struct tm *gmtime_r(const time_t *timep, struct tm *result);

struct tm *localtime(const time_t *timep);
struct tm *localtime_r(const time_t *timep, struct tm *result);

time_t mktime(struct tm *tm);

double difftime(time_t time1, time_t time0);
int gettimeofday(struct timeval *tv, struct timezone *tz);
int settimeofday(const struct timeval *tv , const struct timezone *tz);

즐거운 하루 되세요.

choissi의 이미지

http://bbs.kldp.org/viewtopic.php?t=4099&highlight=time.h+localtime

이전에 한번 쭈욱 정리한것인데 시간
관련 예는 위에 링크된 정보면 되지 않을까 싶네요

울랄라~ 호기심 천국~!!
http://www.ezdoum.com

kihlle의 이미지

/usr/include 아래에서
time.h 와 times.h 등을 검색하시고 그 내용과 관련하여 man page를
참조하시는 것이 가장 좋을 것입니다.

안찾아보신다고 비난하는게 아니라 ^^ 그게 가장 좋은 방법일것 같아서
말씀드리는 것이니 기분나쁘지않으시길 바랍니다.

시간 구조체는
struct tm
struct tms
struct timeval
struct timespec
과 같은 것들이 있고 각각 나름대로 유용합니다.

homeless