{
    "mode": "man",
    "parameter": "time",
    "section": "3am",
    "url": "https://www.chedong.com/phpMan.php/man/time/3am/json",
    "generated": "2026-06-12T16:03:05Z",
    "synopsis": "@load \"time\"\ntime = gettimeofday()\nret = sleep(amount)",
    "sections": {
        "NAME": {
            "content": "time - time functions for gawk\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "@load \"time\"\n\ntime = gettimeofday()\nret = sleep(amount)\n",
            "subsections": []
        },
        "CAUTION": {
            "content": "This  extension  is deprecated in favor of the timex extension in the gawkextlib project.  In\nthe next major release of gawk, loading it will issue a warning.  It will be removed from the\ngawk distribution in the major release after the next one.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The time extension adds two functions named gettimeofday() and sleep(), as follows.\n",
            "subsections": [
                {
                    "name": "gettimeofday()",
                    "content": "This function returns the number of seconds since the Epoch as a floating-point value.\nIt should have subsecond precision.  It returns -1 upon error and sets ERRNO to  indi‐\ncate the problem.\n\nsleep(seconds)\nThis  function  attempts to sleep for the given amount of seconds, which may include a\nfractional portion.  If seconds is negative, or the attempt to sleep  fails,  then  it\nreturns -1 and sets ERRNO.  Otherwise, the function should return 0 after sleeping for\nthe indicated amount of time.\n"
                }
            ]
        },
        "EXAMPLE": {
            "content": "@load \"time\"\n...\nprintf \"It is now %g seconds since the Epoch\\n\", gettimeofday()\nprintf \"Pausing for a while... \" ; sleep(2.5) ; print \"done\"\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "GAWK: Effective AWK Programming, filefuncs(3am), fnmatch(3am), fork(3am), inplace(3am),  ord‐\nchr(3am), readdir(3am), readfile(3am), revoutput(3am), rwarray(3am).\n\ngettimeofday(2), nanosleep(2), select(2).\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Arnold Robbins, arnold@skeeve.com.\n",
            "subsections": []
        },
        "COPYING PERMISSIONS": {
            "content": "Copyright © 2012, 2013, 2018, Free Software Foundation, Inc.\n\nPermission is granted to make and distribute verbatim copies of this manual page provided the\ncopyright notice and this permission notice are preserved on all copies.\n\nPermission is granted to copy and distribute modified versions of this manual page under  the\nconditions  for verbatim copying, provided that the entire resulting derived work is distrib‐\nuted under the terms of a permission notice identical to this one.\n\nPermission is granted to copy and distribute translations of this manual  page  into  another\nlanguage,  under  the above conditions for modified versions, except that this permission no‐\ntice may be stated in a translation approved by the Foundation.\n\n\n\nFree Software Foundation                     Nov 21 2019                                   TIME(3am)",
            "subsections": []
        }
    },
    "summary": "time - time functions for gawk",
    "flags": [],
    "examples": [
        "@load \"time\"",
        "...",
        "printf \"It is now %g seconds since the Epoch\\n\", gettimeofday()",
        "printf \"Pausing for a while... \" ; sleep(2.5) ; print \"done\""
    ],
    "see_also": [
        {
            "name": "filefuncs",
            "section": "3am",
            "url": "https://www.chedong.com/phpMan.php/man/filefuncs/3am/json"
        },
        {
            "name": "fnmatch",
            "section": "3am",
            "url": "https://www.chedong.com/phpMan.php/man/fnmatch/3am/json"
        },
        {
            "name": "fork",
            "section": "3am",
            "url": "https://www.chedong.com/phpMan.php/man/fork/3am/json"
        },
        {
            "name": "inplace",
            "section": "3am",
            "url": "https://www.chedong.com/phpMan.php/man/inplace/3am/json"
        },
        {
            "name": "chr",
            "section": "3am",
            "url": "https://www.chedong.com/phpMan.php/man/chr/3am/json"
        },
        {
            "name": "readdir",
            "section": "3am",
            "url": "https://www.chedong.com/phpMan.php/man/readdir/3am/json"
        },
        {
            "name": "readfile",
            "section": "3am",
            "url": "https://www.chedong.com/phpMan.php/man/readfile/3am/json"
        },
        {
            "name": "revoutput",
            "section": "3am",
            "url": "https://www.chedong.com/phpMan.php/man/revoutput/3am/json"
        },
        {
            "name": "rwarray",
            "section": "3am",
            "url": "https://www.chedong.com/phpMan.php/man/rwarray/3am/json"
        },
        {
            "name": "gettimeofday",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/gettimeofday/2/json"
        },
        {
            "name": "nanosleep",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/nanosleep/2/json"
        },
        {
            "name": "select",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/select/2/json"
        }
    ]
}