neslib / Chet

C Header Translator for Delphi
BSD 2-Clause "Simplified" License
204 stars 43 forks source link

How to include struct tm from C standard library? #29

Closed michkowalczuk closed 9 months ago

michkowalczuk commented 9 months ago

How to #include <ctime> to properly convert struct tm to Delphi?

Here is the structure definition:

struct tm {
   int tm_sec;         /* seconds,  range 0 to 59          */
   int tm_min;         /* minutes, range 0 to 59           */
   int tm_hour;        /* hours, range 0 to 23             */
   int tm_mday;        /* day of the month, range 1 to 31  */
   int tm_mon;         /* month, range 0 to 11             */
   int tm_year;        /* The number of years since 1900   */
   int tm_wday;        /* day of the week, range 0 to 6    */
   int tm_yday;        /* day in the year, range 0 to 365  */
   int tm_isdst;       /* daylight saving time             */   
};

https://en.cppreference.com/w/c/chrono/tm

neslib commented 9 months ago

Hi. Chet is intended to convert 3rd-party headers only. It does not convert system header files since that would lead to a lot of bloat. Many system headers have already been converted by Embarcadero for you. For example, you can find the tm struct in the System.Win.Crtl unit for Windows, or in Posix.Time for all Posix platforms (which is currently all other platforms that Delphi supports).

michkowalczuk commented 9 months ago

It’s great to hear. Thank you.

W dniu śr., 27.09.2023 o 16:52 Erik van Bilsen @.***> napisał(a):

Hi. Chet is intended to convert 3rd-party headers only. It does not convert system header files since that would lead to a lot of bloat. Many system headers have already been converted by Embarcadero for you. For example, you can find the tm struct in the System.Win.Crtl unit for Windows, or in Posix.Time for all Posix platforms (which is currently all other platforms that Delphi supports).

— Reply to this email directly, view it on GitHub https://github.com/neslib/Chet/issues/29#issuecomment-1737564189, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFUL2QXPX4T6CYL3DHNPA2LX4Q4ULANCNFSM6AAAAAA5I4G7BU . You are receiving this because you authored the thread.Message ID: @.***>