- CVI 정보나눔(www.cvi.kr)
- 스터디
- 질문답변
질문,답변
글 수 1,629
안녕하세요...
강좌를 보면서 열심히 따라하면서 배우고 있습니다.
근데 생각없이 지나갔었던 [강좌6]에 의문점이 있습니다.
강좌를 그대로 따라 하면 작동은 문제 없이 됩니다.
근데 날짜를 출력하는데에 있어서 달이 잘못 출력이 됩니다.
이번달이 5월인데 4월로 표시가 됩니다.
날짜를 4월로 바꾸면 3월로 표시가 되는데..
출력하기 전에 1을 더해서 출력을 시키면 문제는 없습니다.
궁금한 것은 왜 이렇게 되는건지 알고 싶습니다.
날짜를 가져올 때 -1이 되어지기 때문인가요?
왜일가요?
강좌를 보면서 열심히 따라하면서 배우고 있습니다.
근데 생각없이 지나갔었던 [강좌6]에 의문점이 있습니다.
강좌를 그대로 따라 하면 작동은 문제 없이 됩니다.
근데 날짜를 출력하는데에 있어서 달이 잘못 출력이 됩니다.
이번달이 5월인데 4월로 표시가 됩니다.
날짜를 4월로 바꾸면 3월로 표시가 되는데..
출력하기 전에 1을 더해서 출력을 시키면 문제는 없습니다.
궁금한 것은 왜 이렇게 되는건지 알고 싶습니다.
날짜를 가져올 때 -1이 되어지기 때문인가요?
왜일가요?
허창원
안병국
감사합니다. 교수님..localtime()의 정의를 찾지 못해서 어떻게 봐야할지
막막했었는데...근데 어떻게 하면 함수들의 정의를 볼 수 있을까요?
막막했었는데...근데 어떻게 하면 함수들의 정의를 볼 수 있을까요?
허창원
LabWindows/CVI의 소스 에디터 화면에서 localtime()이라는 함수의 글자에다 커서를 두고, Ctrl+P (Recall Function Panel)을 누르면, 그 함수에 대한 Function Panel이 뜨면서 해당 항목을 마우스 오른쪽 버튼으로 클릭하면 해당 설명이 나옵니다.
localtime()과 같은 C언어 표준함수들은 차라리 MSDN에서 찾아보는 것도 좋습니다. CVI의 Help보다 더 잘되어 있는 것 같습니다.
localtime() 함수에 대한 MSDN 설명은
target=_blank>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_localtime.asp
여기를 보세요.
그럼,....
localtime()과 같은 C언어 표준함수들은 차라리 MSDN에서 찾아보는 것도 좋습니다. CVI의 Help보다 더 잘되어 있는 것 같습니다.
localtime() 함수에 대한 MSDN 설명은
target=_blank>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_localtime.asp
여기를 보세요.
그럼,....
struct tm *localtime(
const time_t *timer
);
Return Value
Return a pointer to the structure result. If the value in timer represents a date before midnight, January 1, 1970, return NULL.
_localtime64, which uses the __time64_t structure, allows dates to be expressed up through 23:59:59, December 31, 3000, coordinated universal time (UTC), whereas localtime represents dates through 19:14:07 January 18, 2038, UTC.
The fields of the structure type tm store the following values, each of which is an int:
tm_sec
Seconds after minute (0 – 59).
tm_min
Minutes after hour (0 – 59).
tm_hour
Hours after midnight (0 – 23).
tm_mday
Day of month (1 – 31).
tm_mon
Month (0 – 11; January = 0).
tm_year
Year (current year minus 1900).
tm_wday
Day of week (0 – 6; Sunday = 0).
tm_yday
Day of year (0 – 365; January 1 = 0).
tm_isdst
Positive value if daylight saving time is in effect; 0 if daylight saving time is not in effect; negative value if status of daylight saving time is unknown. If the TZ environment variable is set, the C run-time library assumes rules appropriate to the United States for implementing the calculation of daylight-saving time (DST).