Skip to content

Instantly share code, notes, and snippets.

@erichschroeter
erichschroeter / generate.c
Last active August 29, 2015 14:05
Generate program for version header.
#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" \
@erichschroeter
erichschroeter / timestamp.c
Created October 17, 2014 18:20
timestamp
#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);
}