mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	Fix two more problems with time zones and epoch handling
src/cmd/ksh93/edit/history.c: - The `time_t` data type is usually 64-bit, so cast `t` to an unsigned long and use the correct format specifier with sfprintf. src/lib/libast/tm/tmdata.c: - Update the leap second array by adding the current leap seconds that were absent, being: 2016-12-31+23:59:60 1483228826 2015-06-30+23:59:60 1435708825 2012-06-30+23:59:60 1341100824 I couldn't find a proper list of leap seconds in Unix Epoch time, so I used an Epoch Converter: https://www.epochconverter.com/ The converter doesn't support leap seconds, so each conversion had to be corrected by adding the number of leap seconds required (e.g. 1230767999 + 24 = 1230768023, for 2008-12-31+23:59:60 in GMT).
This commit is contained in:
		
							parent
							
								
									6109f54a5e
								
							
						
					
					
						commit
						51f97cf82f
					
				
					 2 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -834,7 +834,7 @@ static int hist_write(Sfio_t *iop,const void *buff,register int insize,Sfdisc_t*
 | 
				
			||||||
	if(hp->auditfp)
 | 
						if(hp->auditfp)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		time_t	t=time((time_t*)0);
 | 
							time_t	t=time((time_t*)0);
 | 
				
			||||||
		sfprintf(hp->auditfp,"%u;%u;%s;%*s%c",sh_isoption(SH_PRIVILEGED)?shgd->euserid:shgd->userid,t,hp->tty,size,buff,0);
 | 
							sfprintf(hp->auditfp,"%u;%lu;%s;%*s%c",sh_isoption(SH_PRIVILEGED)?shgd->euserid:shgd->userid,(unsigned long)t,hp->tty,size,buff,0);
 | 
				
			||||||
		sfsync(hp->auditfp);
 | 
							sfsync(hp->auditfp);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif	/* SHOPT_AUDIT */
 | 
					#endif	/* SHOPT_AUDIT */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -189,6 +189,9 @@ static short	sum[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 36
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Tm_leap_t	leap[] =
 | 
					static Tm_leap_t	leap[] =
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						 1483228826,   27,		/* 2016-12-31+23:59:60-0000 */
 | 
				
			||||||
 | 
						 1435708825,   26,		/* 2015-06-30+23:59:60-0000 */
 | 
				
			||||||
 | 
						 1341100824,   25,		/* 2012-06-30+23:59:60-0000 */
 | 
				
			||||||
	 1230768023,   24,		/* 2008-12-31+23:59:60-0000 */
 | 
						 1230768023,   24,		/* 2008-12-31+23:59:60-0000 */
 | 
				
			||||||
	 1136073622,   23,		/* 2005-12-31+23:59:60-0000 */
 | 
						 1136073622,   23,		/* 2005-12-31+23:59:60-0000 */
 | 
				
			||||||
	  915148821,   22,		/* 1998-12-31+23:59:60-0000 */
 | 
						  915148821,   22,		/* 1998-12-31+23:59:60-0000 */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue