Skip to content

Instantly share code, notes, and snippets.

@Arkham
Created April 14, 2013 08:43
Show Gist options
  • Save Arkham/5381976 to your computer and use it in GitHub Desktop.
Save Arkham/5381976 to your computer and use it in GitHub Desktop.
date
#include "../apue.h"
#include <time.h>
#define BUFSIZE 256
int
main(void)
{
char result[BUFSIZE];
time_t now;
struct tm *ptr;
now = time(NULL);
ptr = localtime(&now);
if (strftime(result, BUFSIZE, "%a %b %d %T %Z %Y", ptr) < 0)
err_sys("strftime error");
printf("%s\n", result);
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment