2012년 4월 4일 수요일

solaris: make the time-string in the kernel

커널 내부에서 time string을 만드는 방법


#define KOR_PARALLAX_SEC (32400) // 9 hour
static char *month_string[12] = {  "Jan", "Feb", "Mar", "Apr",
                                                     "May", "Jun", "Jul", "Aug",
                                                     "Sep", "Oct", "Nov", "Dec"};

static int getoftime_kor(todinfo_t *tod)
{
        time_t utc = 0;

        if( tod == NULL )
                return -1;

        //get the current unix time
        utc = ddi_get_time();

        // 한국 시차를 생각하여 9시간을 플러스 한다.
        utc = utc + KOR_PARALLAX_SEC;   

        // 년, 월, 일, 분, 초를 계산하여 tod 구조체를 설정 한다.
        *tod = utc_to_tod(utc);

        return 0;
}

댓글 없음:

댓글 쓰기