Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 861
    • Issues 861
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 43
    • Merge requests 43
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Issues
  • #1438
Closed
Open
Issue created Jul 10, 2018 by Jasper Lievisse Adriaanse@jasperla

Deprecate GTimeVal- and GTime-based APIs

On OpenBSD time_t is defined as a 64 bit type on all our platforms __int64_t __time_t; (long long). Subsequently struct timeval is defined as:

struct timeval {
        time_t          tv_sec;         /* seconds */
        suseconds_t     tv_usec;        /* and microseconds */
}

(suseconds_t is a long)

Comparing this against GLib's GTimeVal:

struct _GTimeVal
{
  glong tv_sec;
  glong tv_usec;
};

This means that a GTimeVal.tv_sec is smaller than the OS-level counterpart and leads to various compilation warnings. Such as:

../gcab-1.0/src/gcab.c:201:41: warning: incompatible pointer types passing 'glong *' (aka 'long *') to parameter of type 'const time_t *' (aka 'const long long *') [-Wincompatible-pointer-types]
                        tm = localtime (&tv.tv_sec);
                                        ^~~~~~~~~~
/usr/include/time.h:129:36: note: passing argument to parameter here
struct tm *localtime(const time_t *);
                                   ^
1 warning generated.

Also note that GTime is defined as a gint32. How should we go about addressing this issue in a matter?

Edited May 07, 2019 by Philip Withnall
Assignee
Assign to
Time tracking