POSIX.1 형식의 TZ 변수 스트링 -> tz file 변환 방법 아시는 분 계신가요?

dorado2의 이미지


안녕하세요.

현재 주어진 TZ 변수를 바탕으로 해당 TIMEZONE을 system 전체에 적용해야 합니다.

단순한 export TZ나 putenv 방법을 통해서는 해당 process에만 적용이 되기 때문에 문제입니다.

/usr/share/zoneinfo/ 아래 zoneinfo file을 /etc/localtime으로 link하는 방법 역시 사용할 수는 없구요.
(정말 잡다한 나라를 설정해야 합니다.)

TZ="NZST-12.00:00NZDT-13:00:00,M10.1.0,M3.3.0" 등의 형태로 주어지면,
해당 TZ 변수를 가지고 tz file을 만들고, zic로 컴파일하여 저장한 후에 /etc/localtime으로 심볼릭 링크하려고 합니다.

이게 거의 유일한 solution 같은데요, 적당한 방법이 없을까요?
스크립트나 C coding으로 해결해보려고 합니다. 힌트라도 얻을 수 있다면요.

구글을 뒤져본결과, 유즈넷에도 제가 하고자 하는 질문과 100% 동일한 내용이 있지만, 역시나 답변이 없네요..

http://www.usenet-forums.com/linux-general/83948-converting-tz-string-tz-file.html

dorado2의 이미지


POSIX.1 tz variable format 을 parsing하여
rule 에 맞게 tz file로 변환하는게 아주 복잡한 것 같아서 엄두가 안 나고 있네요.

aero의 이미지

dorado2의 이미지


위 사이트의 perl 스크립트를 받아서 살펴보았는데, 목적한 바와는 좀 다르네요.

update-zoneinfo.pl 스크립트는 tzdata 파일을 받아온 후에,
zic로 컴파일해서 생성된 zoneinfo 파일로 timezone을 설정하네요.

저는 posix.1 형식의 TZ 변수 (ex. TZ="NZST-12.00:00NZDT-13:00:00,M10.1.0,M3.3.0") 를
tz file (tzdata)로 변환하는 부분을 찾고 있어서요.

더군다나 타겟 시스템에 perl이 없는 상황이라 ^_^. tz file을 만들면 zic로 처리하는 그 이후 과정은
쉬울 것으로 예상하고 있습니다.

답변 감사드립니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.