[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Private/DateTimeFormat
From: |
Gopal.V <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Private/DateTimeFormat ParsedDateTime.cs,1.2,1.3 |
Date: |
Fri, 09 May 2003 15:55:01 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Private/DateTimeFormat
In directory subversions:/tmp/cvs-serv7537/runtime/System/Private/DateTimeFormat
Modified Files:
ParsedDateTime.cs
Log Message:
Refactor a bit of stuff
Index: ParsedDateTime.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Private/DateTimeFormat/ParsedDateTime.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ParsedDateTime.cs 6 Mar 2003 17:33:19 -0000 1.2
--- ParsedDateTime.cs 9 May 2003 19:54:58 -0000 1.3
***************
*** 38,42 ****
bool hasAMPM = false;
bool hasFractionalSecond = false;
- bool hasStyle = false;
bool hasTicks = false;
bool hasUTC = false;
--- 38,41 ----
***************
*** 53,67 ****
{
bool hasDate = hasDay && hasMonth && hasYear;
! bool hasTime = (hasTwentyfourHour || hasTwelveHour) &&
! hasMinute;
! DateTime new_dt;
! if( (style == DateTimeStyles.NoCurrentDateDefault) &&
!hasDate)
{
! hasStyle=true;
}
! if( hasUTC && (hasDate || hasTime ) )
! throw new FormatException("Cannot set UTC and
other time value");
if( hasAMPM && hasTwelveHour)
--- 52,72 ----
{
bool hasDate = hasDay && hasMonth && hasYear;
! bool hasTime = (hasTwentyfourHour || hasTwelveHour) &&
hasMinute;
! DateTime newDate;
!
! DateTime baseDate;
! if((style == DateTimeStyles.NoCurrentDateDefault) &&
!hasDate)
! {
! baseDate = new DateTime(0);
! }
! else
{
! baseDate = DateTime.Now;
}
! /* TODO : Figure out if the latter case is right */
! /* if( hasUTC && (hasDate || hasTime ) )
! throw new FormatException("Cannot set UTC and
other time value"); */
if( hasAMPM && hasTwelveHour)
***************
*** 73,126 ****
// begin picking which items to construct datetime
object with
! if( hasUTC )
! {
! if( hasStyle )
! return new_dt = new DateTime(1, 1, 1,
hr, this.Minute, 0 );
! return new_dt = new DateTime(this.Year,
this.Month, this.Day,
! hr, this.Minute, this.Second);
! }
! else if( hasDate && !hasTime )
{
// set date of object, time is 00:00:00
! new_dt = new DateTime(this.Year, this.Month,
this.Day);
}
else if( hasTime && !hasDate )
{
! if( hasStyle )
! {
! this.Year=1;
! this.Month=1;
! this.Day=1;
! new_dt = new DateTime(this.Year,
this.Month, this.Day, hr,
! this.Minute, this.Second);
! }
! else
! {
! new_dt = new
DateTime((DateTime.Now).Year, (DateTime.Now).Month,
! (DateTime.Now).Day, hr,
this.Minute, this.Second);
! }
}
else if( hasDate && hasTime )
{
! new_dt = new DateTime(this.Year, this.Month,
this.Day, hr,
this.Minute, this.Second);
}
else if( hasDay && hasMonth )
{
! new_dt = new DateTime((DateTime.Now).Year,
this.Month, this.Day);
}
else if( hasTwentyfourHour && hasMinute )
{
! new_dt = new DateTime((DateTime.Now).Year,
(DateTime.Now).Month,
! (DateTime.Now).Day, hr, this.Minute,
(DateTime.Now).Second);
}
else if( hasTwentyfourHour && hasMinute )
{
! new_dt = new DateTime((DateTime.Now).Year,
(DateTime.Now).Month,
! (DateTime.Now).Day, hr, this.Minute,
(DateTime.Now).Second);
}
else if( hasYear && hasMonth )
{
! new_dt = new DateTime(this.Year, this.Month,
(DateTime.Now).Day);
}
else
--- 78,113 ----
// begin picking which items to construct datetime
object with
! if( hasDate && !hasTime )
{
// set date of object, time is 00:00:00
! newDate = new DateTime(this.Year, this.Month,
this.Day);
}
else if( hasTime && !hasDate )
{
! newDate = new DateTime((baseDate).Year,
(baseDate).Month,
! (baseDate).Day, hr,
this.Minute, this.Second);
}
else if( hasDate && hasTime )
{
! newDate = new DateTime(this.Year, this.Month,
this.Day, hr,
this.Minute, this.Second);
}
else if( hasDay && hasMonth )
{
! newDate = new DateTime((baseDate).Year,
this.Month, this.Day);
}
else if( hasTwentyfourHour && hasMinute )
{
! newDate = new DateTime((baseDate).Year,
(baseDate).Month,
! (baseDate).Day, hr, this.Minute,
(baseDate).Second);
}
else if( hasTwentyfourHour && hasMinute )
{
! newDate = new DateTime((baseDate).Year,
(baseDate).Month,
! (baseDate).Day, hr, this.Minute,
(baseDate).Second);
}
else if( hasYear && hasMonth )
{
! newDate = new DateTime(this.Year, this.Month,
(baseDate).Day);
}
else
***************
*** 128,135 ****
throw new FormatException("Could not store
parsed date");
}
! if( hasFractionalSecond )
! new_dt = new_dt.Add(new TimeSpan(fs) );
! return new_dt;
}
internal int Day
{
--- 115,124 ----
throw new FormatException("Could not store
parsed date");
}
! if( hasFractionalSecond )
! newDate = newDate.Add(new TimeSpan(fs)
);
!
! return newDate;
}
+
internal int Day
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Private/DateTimeFormat ParsedDateTime.cs,1.2,1.3,
Gopal.V <address@hidden> <=