kernels/linux-2.4.0/fs/smbfs/proc.c
/* Convert linear UNIX date to a MS-DOS time/date pair. */
Convert linear UNIX date to a MS-DOS time/date pair.
Convert linear UNIX date to a MS - DOS time / date pair .
static void
date_unix2dos(struct smb_sb_info *server,
	      int unix_date, __u16 *date, __u16 *time)
{
	int day, year, nl_day, month;
	unix_date = utc2local(server, unix_date);
	*time = (unix_date % 60) / 2 +
		(((unix_date / 60) % 60) << 5) +
		(((unix_date / 3600) % 24) << 11);
	day = unix_date / 86400 - 3652;
	year = day / 365;
	if ((year + 3) / 4 + 365 * year > day)
		year--;
	day -= (year + 3) / 4 + 365 * year;
	if (day == 59 && !(year & 3)) {
		nl_day = day;
		month = 2;
	} else {
		nl_day = (year & 3) || day <= 59 ? day : day - 1;
		for (month = 0; month < 12; month++)
			if (day_n[month] > nl_day)
				break;
	}
	*date = nl_day - day_n[month - 1] + 1 + (month << 5) + (year << 9);
}
static void date_unix2dos ( struct smb_sb_info * server , int unix_date , __u16 * date , __u16 * time ) { int day , year , nl_day , month ; unix_date = utc2local ( server , unix_date ) ; * time = ( unix_date % 60 ) / 2 + ( ( ( unix_date / 60 ) % 60 ) << 5 ) + ( ( ( unix_date / 3600 ) % 24 ) << 11 ) ; day = unix_date / 86400 - 3652 ; year = day / 365 ; if ( ( year + 3 ) / 4 + 365 * year > day ) year -- ; day -= ( year + 3 ) / 4 + 365 * year ; if ( day == 59 && ! ( year & 3 ) ) { nl_day = day ; month = 2 ; } else { nl_day = ( year & 3 ) || day <= 59 ? day : day - 1 ; for ( month = 0 ; month < 12 ; month ++ ) if ( day_n [ month ] > nl_day ) break ; } * date = nl_day - day_n [ month - 1 ] + 1 + ( month << 5 ) + ( year << 9 ) ; }
Convert linear UNIX date to a MS-DOS time/date pair.
Convert linear UNIX date to a MS - DOS time / date pair .