The Samba-Bugzilla – Attachment 1186 Details for
Bug 2663
Improper timestamps set in cli_setattrE and cli_setatr
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for time.c
timepatch (text/plain), 2.46 KB, created by
Satwik Hebbar
on 2005-04-27 23:49:33 UTC
(
hide
)
Description:
Patch for time.c
Filename:
MIME Type:
Creator:
Satwik Hebbar
Created:
2005-04-27 23:49:33 UTC
Size:
2.46 KB
patch
obsolete
>--- time.c.old 2005-04-28 12:18:05.000000000 +0530 >+++ time.c 2005-04-27 22:53:11.000000000 +0530 >@@ -25,6 +25,11 @@ > in May 1996 > */ > >+//I NEED THIS! >+/* Linear day numbers of the respective 1sts in non-leap years. */ >+ >+static int day_n[] = >+{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 0, 0, 0, 0}; > > int extra_time_offset = 0; > >@@ -579,9 +584,36 @@ > > void put_dos_date3(char *buf,int offset,time_t unixdate) > { >- if (!null_mtime(unixdate)) >- unixdate -= TimeDiff(unixdate); >- SIVAL(buf,offset,unixdate); >+ /*if (!null_mtime(unixdate)) >+ unixdate -= TimeDiff(unixdate); >+ SIVAL(buf,offset,unixdate);*/ >+ >+int time16, day16, year16, month16, nl_day16, date16, dosdate; >+ if (unixdate < 315532800) >+ unixdate = 315532800; >+ >+ time16 = (unixdate % 60) / 2 + >+ (((unixdate / 60) % 60) << 5) + >+ (((unixdate / 3600) % 24) << 11); >+ >+ day16 = unixdate / 86400 - 3652; >+ year16 = day16 / 365; >+ if ((year16 + 3) / 4 + 365 * year16 > day16) >+ year16--; >+ day16 -= (year16 + 3) / 4 + 365 * year16; >+ if (day16 == 59 && !(year16 & 3)) { >+ nl_day16 = day16; >+ month16 = 2; >+ } else { >+ nl_day16 = (year16 & 3) || day16 <= 59 ? day16 : day16 - 1; >+ for (month16 = 0; month16 < 12; month16++) >+ if (day_n[month16] > nl_day16) >+ break; >+ } >+ date16 = nl_day16 - day_n[month16 - 1] + 1 + (month16 << 5) + (year16 << 9); >+ >+ dosdate = ((time16 << 16) & 0xffff0000) | (date16 & 0x0000ffff); >+ SIVAL(buf,offset,dosdate); > } > > /******************************************************************* >@@ -651,10 +683,27 @@ > > time_t make_unix_date3(void *date_ptr) > { >- time_t t = (time_t)IVAL(date_ptr,0); >- if (!null_mtime(t)) >- t += LocTimeDiff(t); >- return(t); >+ /*time_t t = (time_t)IVAL(date_ptr,0); >+ if (!null_mtime(t)) >+ t += LocTimeDiff(t); >+ return(t);*/ >+ >+ time_t t = (time_t)IVAL(date_ptr,0); >+ int month, year; >+ time_t secs; >+ >+ int time16, date16; >+ /* printf("Dos time %x \n",t); */ >+ time16 = (t>>16) & 0x0000ffff; // time is the higher 2 bytes >+ date16 = t & 0x0000ffff; // date is the lower 2 bytes >+ >+ month = ((date16 >> 5) - 1) & 15; >+ year = date16 >> 9; >+ secs = (time16 & 31) * 2 + 60 * ((time16 >> 5) & 63) + (time16 >> 11) * 3600 + 86400 * >+ ((date16 & 31) - 1 + day_n[month] + (year / 4) + year * 365 - ((year & 3) == 0 && >+ month < 2 ? 1 : 0) + 3653); >+ /* printf ("Before returning %x \n", secs); */ >+ return secs; > } > > /***************************************************************************
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 2663
: 1186 |
1187