Ignore:
Timestamp:
Feb 16, 2007, 6:58:51 PM (18 years ago)
Author:
OverTaker
Message:

列挙体をタイプセーフにしました。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/DateTime.ab

    r93 r103  
    1313    Sub DateTime(ticks As Int64)
    1414        Ticks = ticks
    15         Kind = Unspecified
     15        Kind = DateTimeKind.Unspecified
    1616    End Sub
    1717
     
    5454    End Sub
    5555
    56 /*  Sub DateTime(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long, kind As DateTimeKind)
     56    Sub DateTime(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long, kind As DateTimeKind)
    5757        DateTime(year, month, day, hour, minute, second)
    5858        Kind = kind
    59     End Sub*/
     59    End Sub
    6060
    6161    Sub DateTime(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long, millisecond As Long)
     
    199199        Dim time As SYSTEMTIME
    200200        GetLocalTime(time)
    201         Dim date As DateTime(time, Local)
     201        Dim date As DateTime(time, DateTimeKind.Local)
    202202        Return date
    203203    End Function
     
    206206        Dim time As SYSTEMTIME
    207207        GetLocalTime(time)
    208         Dim date As DateTime(time.wYear, time.wMonth, time.wDay, Local)
     208        Dim date As DateTime(time.wYear, time.wMonth, time.wDay, DateTimeKind.Local)
    209209        Return date
    210210    End Function
     
    213213        Dim time As SYSTEMTIME
    214214        GetSystemTime(time)
    215         Dim date As DateTime(time, Utc)
     215        Dim date As DateTime(time, DateTimeKind.Utc)
    216216        Return date
    217217    End Function
     
    304304        If (year Mod 100) = 0 Then Return False
    305305        If (year Mod 4) = 0 Then Return True
     306        Return False
    306307    End Function
    307308
     
    357358        FileTimeToSystemTime(localTime, time)
    358359
    359         Dim date As DateTime(time, Local)
     360        Dim date As DateTime(time, DateTimeKind.Local)
    360361        Return date
    361362    End Function
     
    382383        FileTimeToSystemTime(fileTime, time)
    383384
    384         Dim date As DateTime(time, Utc)
     385        Dim date As DateTime(time, DateTimeKind.Utc)
    385386        Return date
    386387    End Function
     
    389390        Dim fileTime As FILETIME
    390391        fileTime = ToFileTime()
    391         If Kind = Utc Then
     392        If Kind = DateTimeKind.Utc Then
    392393            ToFileTimeUtc = fileTime
    393394        Else
     
    397398
    398399    Function ToLocalTime() As DateTime
    399         If Kind = Local Then
     400        If Kind = DateTimeKind.Local Then
    400401            ToLocalTime = This
    401402        Else
    402403            ToLocalTime = DateTime.FromFileTime(ToFileTime())
    403             ToLocalTime.Kind = Local
     404            ToLocalTime.Kind = DateTimeKind.Local
    404405        End If
    405406    End Function
    406407
    407408    Function ToUniversalTime() As DateTime
    408         If Kind = Utc Then
     409        If Kind = DateTimeKind.Utc Then
    409410            ToUniversalTime = This
    410411        Else
    411412            ToUniversalTime = DateTime.FromFileTimeUtc(ToFileTimeUtc())
    412             ToUniversalTime.Kind = Utc
     413            ToUniversalTime.Kind = DateTimeKind.Utc
    413414        End If
    414415    End Function
     
    432433    End Function
    433434
    434     Function kindFromBinary(dateData As Int64) As Long
     435    Function kindFromBinary(dateData As Int64) As DateTimeKind
    435436        dateData = (dateData >> 62) And &H03
    436437        If dateData = &H01 Then
    437             Return Local
     438            Return DateTimeKind.Local
    438439        ElseIf dateData = &H02 Then
    439             Return Unspecified
     440            Return DateTimeKind.Unspecified
    440441        ElseIf dateData = &H03 Then
    441             Return Utc
     442            Return DateTimeKind.Utc
    442443        End If
    443444    End Function
    444445End Class
    445446
    446 Const Enum DateTimeKind
     447Enum DateTimeKind
    447448    Local
    448449    Unspecified
     
    450451End Enum
    451452
    452 Const Enum DayOfWeek
     453Enum DayOfWeek
    453454    Sunday = 0
    454455    Monday
Note: See TracChangeset for help on using the changeset viewer.