Giter VIP home page Giter VIP logo

Comments (3)

alfredh avatar alfredh commented on May 18, 2024

check out the DBG_TIME option in dbg_init:

/** Debug flags */
enum dbg_flags {
	DBG_NONE = 0,                 /**< No debug flags         */
	DBG_TIME = 1<<0,              /**< Print timestamp flag   */
	DBG_ANSI = 1<<1,              /**< Print ANSI color codes */
	DBG_ALL  = DBG_TIME|DBG_ANSI  /**< All flags enabled      */
};

void dbg_init(int level, enum dbg_flags flags);

If you enable DBG_TIME it will prefix all loglines with the timestamp.

Alfred

from re.

lxlenovostar avatar lxlenovostar commented on May 18, 2024

I set the options withe dbg_init:
dbg_init(DBG_DEBUG, DBG_ALL);

I think this time is program running time, not system time.

Thank you.

from re.

alfredh avatar alfredh commented on May 18, 2024

for questions about how to use the API it is better to use the mailing list:

http://lists.creytiv.com/mailman/listinfo/re-devel

here is a simple test program using fmt_gmtime and fmt_human_time

#include <re.h>


int main(void)
{
	uint32_t seconds = 3600 + 60 + 5;

	re_printf("gmtime:      %H\n", fmt_gmtime, NULL);
	re_printf("human_time:  %H\n", fmt_human_time, &seconds);
}

and the output:

./test 
gmtime:      Thu, 05 Apr 2018 06:48:48 GMT
human_time:  1 hour 1 min 5 secs

from re.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.