Merge pull request #7 from ccawley2011/msvc
[debian-nspark.git] / date.c
blob51213e10a284ebcbae083207fdd6d8900e3a803a
2 /*
3 * manipulate date types
5 * $Header: date.c 1.4 92/12/07 $
6 * $Log: date.c,v $
7 * Revision 1.4 92/12/07 17:17:47 duplain
8 * reformatted source.
9 *
10 * Revision 1.3 92/11/06 12:43:06 duplain
11 * Removed check for "time-stamped header" in makedate().
13 * Revision 1.2 92/10/06 12:12:10 duplain
14 * Fixed makedate().
16 * Revision 1.1 92/09/29 18:02:17 duplain
17 * Initial revision
21 #include <stdio.h>
22 #include "spark.h"
24 static char *monthnames[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
25 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
29 * Build date structure from load and exec fields
31 Date *
32 makedate(Header *header)
34 static Date date;
35 register Halfword arcdate = header->date;
36 register Halfword arctime = header->time;
38 date.second = (arctime & 0x1f) * 2;
39 date.minute = (arctime >> 5) & 0x3f;
40 date.hour = (arctime >> 11) & 0x1f;
41 date.day = arcdate & 0x1f;
42 date.month = (arcdate >> 5) & 0x0f;
43 date.year = ((arcdate >> 9) & 0x7f) + 80;
44 return (&date);
47 char *
48 monthname(int month)
50 if (month > 0 && month < 13)
51 return (monthnames[month - 1]);
52 else
53 return ("XXX");