~ubuntu-branches/debian/squeeze/ntp/squeeze-201010051545

« back to all changes in this revision

Viewing changes to libntp/caljulian.c

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2004-10-11 16:10:27 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041011161027-icyjbji8ujym633o
Tags: 1:4.2.0a-10ubuntu2
Use ntp.ubuntulinux.org instead of pool.ntp.org

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
#include "ntp_types.h"
7
7
#include "ntp_calendar.h"
8
8
#include "ntp_stdlib.h"
 
9
#include "ntp_fp.h"
9
10
 
 
11
#if 0
10
12
/*
11
13
 * calmonthtab - days-in-the-month table
12
14
 */
110
112
                break;
111
113
        }
112
114
        jt->month++;
113
 
        jt->monthday = monthday;
 
115
        jt->monthday = (u_char) monthday;
114
116
        }
115
117
}
 
118
#else
 
119
 
 
120
/* Updated 2003-12-30 TMa
 
121
 
 
122
   Uses common code with the *prettydate functions to convert an ntp
 
123
   seconds count into a calendar date.
 
124
   Will handle ntp epoch wraparound as long as the underlying os/library 
 
125
   does so for the unix epoch, i.e. works after 2038.
 
126
*/
 
127
 
 
128
void
 
129
caljulian(
 
130
        u_long                          ntptime,
 
131
        register struct calendar        *jt
 
132
        )
 
133
{
 
134
        struct tm *tm;
 
135
 
 
136
        tm = ntp2unix_tm(ntptime, 0);
 
137
 
 
138
        jt->hour = (u_char) tm->tm_hour;
 
139
        jt->minute = (u_char) tm->tm_min;
 
140
        jt->month = (u_char) (tm->tm_mon + 1);
 
141
        jt->monthday = (u_char) tm->tm_mday;
 
142
        jt->second = (u_char) tm->tm_sec;
 
143
        jt->year = (u_short) (tm->tm_year + 1900);
 
144
        jt->yearday = (u_short) (tm->tm_yday + 1);  /* Assumes tm_yday starts with day 0! */
 
145
}
 
146
#endif