Skip to content
Advertisement

Why tm_gmtoff field of struct tm is not documented in man page?

I need to get the difference between UTC and the local time using GCC on Linux. It seems that the preferred way is to examine tm_gmtoff field of a struct tm returned by localtime function.

https://stackoverflow.com/a/47218792

However, tm_gmtoff is not documented in the man page of localtime, but only tm_zone is.

https://man7.org/linux/man-pages/man3/localtime.3.html

It looks like tm_gmtoff and tm_zone exist in the header file.

  19 # ifdef __USE_MISC
  20   long int tm_gmtoff;           /* Seconds east of UTC.  */
  21   const char *tm_zone;          /* Timezone abbreviation.  */
  22 # else
  23   long int __tm_gmtoff;         /* Seconds east of UTC.  */
  24   const char *__tm_zone;        /* Timezone abbreviation.  */
  25 # endif

https://sourceware.org/git/?p=glibc.git;a=blob;f=time/bits/types/struct_tm.h;h=b13b631228d0ec36691b25db2e1f9b1d66b54bb0;hb=HEAD

I’m not sure why tm_gmtoff is omitted in the man page. Could it be a man-page bug introduced in the following commit?

https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man3/ctime.3?id=ba39b288ab07149417867533821300256f310615&h=master

Advertisement

Answer

I reported this to the maintainers. It has been fixed by the following commit.

https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=20f1ee93171895341877b8c5679a33823c4ca582

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement