GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cobol

cobol: C posix-gettime binding to COBOL

GCC COBOL now provides bindings for the C POSIX `gettimeofday` and `clock_gettime` functions.

GCC’s COBOL compiler now supports calling C POSIX time functions, specifically gettimeofday and clock_gettime. This change introduces new C shim functions and COBOL copy/source files to enable this interoperability. It also includes a smoke test to verify the functionality.

In Details

This commit adds bindings for POSIX time functions to libgcobol. It introduces shim implementations in posix/shim/gettime.cc and header posix/shim/timespec.h, along with COBOL interfaces in posix/cpy/posix-clock-gettime.cpy and user-defined functions in posix/udf/posix-clock-gettime.cbl. A smoke test in posix/t/gettime.cbl verifies the integration.

For Context
COBOL
A compiled programming language designed for business applications. GCC includes a compiler for COBOL.
POSIX
A family of standards specified by the IEEE for maintaining compatibility between operating systems, primarily Unix-like systems. POSIX specifies system interfaces, utilities, and shells.
gettimeofday
A POSIX function that returns the time since the Epoch (00:00:00 UTC, January 1, 1970) and the local time offset from UTC.
clock_gettime
A POSIX function that provides more precise time-of-day and clock information, allowing the use of different system clocks (e.g., monotonic clock).
binding
In programming, a binding allows code written in one language to call functions or use data structures defined in another language.
libgcobol
The runtime library for the GNU COBOL compiler.
Filed Under: cobolposixruntime