Welcome to mirror list, hosted at ThFree Co, Russian Federation.

asctime_r.c « time « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 93e3fc27f8f4d8d9759700254ec408ae6dc15c7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * asctime_r.c
 */

#include <stdio.h>
#include <time.h>

char *
_DEFUN (asctime_r, (tim_p, result),
	const struct tm *__restrict tim_p,
	char *__restrict result)
{
  static const char day_name[7][3] = {
	"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
  };
  static const char mon_name[12][3] = {
	"Jan", "Feb", "Mar", "Apr", "May", "Jun", 
	"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  };

  siprintf (result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
	    day_name[tim_p->tm_wday], 
	    mon_name[tim_p->tm_mon],
	    tim_p->tm_mday, tim_p->tm_hour, tim_p->tm_min,
	    tim_p->tm_sec, 1900 + tim_p->tm_year);
  return result;
}