gettimeofday함수가 posix표준에서 빠지고 새로 생신 함수 clock_gettime함수를 사용하여 디버그에서 시간을 출력해보았다.
예제
#include <stdio.h>
#include <time.h>
//------------------------------------------------------------------------------
// 설명 : 디버그 프린트
//------------------------------------------------------------------------------
int debug_printf( const char *fmt, ... )
{
va_list ap;
int len;
struct timespec time;
struct tm *ptm;
if ( 0 == clock_gettime( CLOCK_REALTIME, &time)) {
ptm = localtime(&time.tv_sec);
printf("%02d%02d%02d%02d%02d%02d]",(ptm->tm_year%100), ptm->tm_mon+1, ptm->tm_mday
, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
}
va_start(ap, fmt);
len = vprintf(fmt, ap);
va_end(ap);
return len;
}
아래는 각 함수의 선언부분을 찾아봤다. clock_gettime함수는 second, ms에 ns까지 구할 수 있다.
#include <time.h> int clock_gettime(clockid_t clock_id, struct timespec *tp); struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; -------------------------------------------------------------- #include <sys/time.h> int gettimeofday( struct timeval *restrict tp, void *restrict tzp); struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* microseconds */ }; |
출처: http://sunyzero.tistory.com/161 [IT 지식 창고]
'IT관련 지식들' 카테고리의 다른 글
우분투에서 libusb 사용 시작하기. (1) | 2017.03.08 |
---|---|
우분투 계정 관리 (0) | 2017.02.23 |
우분투 'kr.archive.ubuntu.com'의 주소를 알아낼 수 없습니다 (2) | 2017.01.17 |
윈도우즈 git 설치 및 사용. (0) | 2016.11.18 |
python 에서 v4l2 모듈이 없다고 나올 때. (0) | 2016.11.04 |
문제 상황
- apt-get 명령어로 업그레이드, 업데이트, 패키지 설치를 하는데 아래와 같은 에러메시지가 나오는 경우.
***************************
오류 http://kr.archive.ubuntu.com/ubuntu/ trusty-backports/main libcgmanager0 i386 0.39-2ubuntu2~ubuntu14.04.1
'kr.archive.ubuntu.com'의 주소를 알아낼 수 없습니다
...
***************************
다들 미러서버 문제라고 하여 아래와 같은 해결책을 제시한다.
=========================================
kr.archive.ubuntu.com으로 잡혀있을 경우
CODE: SELECT ALL
sudo vi /etc/apt/sources.list
:%s/kr.archive.ubuntu.com/ftp.neowiz.com/g
:wq
다음 서버로 잡혀있을 경우
CODE: SELECT ALL
sudo vi /etc/apt/sources.list
:%s/ftp.daum.net/ftp.neowiz.com/g
:wq
=========================================
하지만 내 경우는 DHCP 유동 아이피를 고정아이피로 변경을 했더니 나오는 문제였다.
ip설정에 DNS 서버를 추가하면 문제가 해결된다.
'IT관련 지식들' 카테고리의 다른 글
우분투 계정 관리 (0) | 2017.02.23 |
---|---|
clock_gettime함수 (0) | 2017.02.13 |
윈도우즈 git 설치 및 사용. (0) | 2016.11.18 |
python 에서 v4l2 모듈이 없다고 나올 때. (0) | 2016.11.04 |
ccollaborator 설치(코드리뷰) (0) | 2016.10.31 |
1. 설치
- git 프로그램과 tortoiseGit을 둘 다 설치하는 것이 편리합니다.
- git 프로그램 다운로드
- tortoiseGit & 언어팩 다운로드
https://tortoisegit.org/download/
32bit, 64bit를 잘 확인하고 파일을 실행합니다.
특별히 변경하는 사항 없이 "다음"을 누르면 문제없이 설치 됩니다.
2. 사용 방법.
2.1 계정 등록.
- 윈도우 탐색기에서 우클릭 -> 설정
- git -> 사용자 정보와 이메일 주소 입력.
'IT관련 지식들' 카테고리의 다른 글
clock_gettime함수 (0) | 2017.02.13 |
---|---|
우분투 'kr.archive.ubuntu.com'의 주소를 알아낼 수 없습니다 (2) | 2017.01.17 |
python 에서 v4l2 모듈이 없다고 나올 때. (0) | 2016.11.04 |
ccollaborator 설치(코드리뷰) (0) | 2016.10.31 |
Git 사용. (0) | 2016.10.26 |