Skip to content

Instantly share code, notes, and snippets.

@erichschroeter
erichschroeter / generate.c
Last active Aug 29, 2015
Generate program for version header.
View generate.c
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <getopt.h>
#include <time.h>
#define VERSION_H \
"#ifndef %s_VERSION_H\n" \
"#define %s_VERSION_H\n" \
View timestamp.c
#include <stdio.h>
#include <time.h>
void ptimestamp_micro(struct timespec *now, char *text)
{
long us = (now->tv_sec * 1000000) + (now->tv_nsec / 1000);
printf("%ld%s", us, text);
}