Skip to content

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.

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

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;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?



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

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