System.TimeSpan.TTimeSpan

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

  TTimeSpan = record
  private
    FTicks: Int64;
  strict private
    function GetDays: Integer;
    function GetHours: Integer;
    function GetMinutes: Integer;
    function GetSeconds: Integer;
    function GetMilliseconds: Integer;
    function GetTotalDays: Double;
    function GetTotalHours: Double;
    function GetTotalMinutes: Double;
    function GetTotalSeconds: Double;
    function GetTotalMilliseconds: Double;
    function ToString: string;
    class function GetScaledInterval(Value: Double; Scale: Integer): TTimeSpan; static;
    class constructor Create;
  strict private class var
    FMinValue: TTimeSpan{ = (FTicks: -9223372036854775808)};
    FMaxValue: TTimeSpan{ = (FTicks: $7FFFFFFFFFFFFFFF)};
    FZero: TTimeSpan;
  strict private const
    MillisecondsPerTick = 0.0001;
    SecondsPerTick = 1e-07;
    MinutesPerTick = 1.6666666666666667E-09;
    HoursPerTick = 2.7777777777777777E-11;
    DaysPerTick = 1.1574074074074074E-12;
    MillisPerSecond = 1000;
    MillisPerMinute = 60 * MillisPerSecond;
    MillisPerHour = 60 * MillisPerMinute;
    MillisPerDay = 24 * MillisPerHour;
    MaxSeconds = 922337203685;
    MinSeconds = -922337203685;
    MaxMilliseconds = 922337203685477;
    MinMilliseconds = -922337203685477;
  public const
    TicksPerMillisecond = 10000;
    TicksPerSecond = 1000 * Int64(TicksPerMillisecond);
    TicksPerMinute = 60 * Int64(TicksPerSecond);
    TicksPerHour = 60 * Int64(TicksPerMinute);
    TicksPerDay = 24 * TIcksPerHour;
  public
    constructor Create(ATicks: Int64); overload;
    constructor Create(Hours, Minutes, Seconds: Integer); overload;
    constructor Create(Days, Hours, Minutes, Seconds: Integer); overload;
    constructor Create(Days, Hours, Minutes, Seconds, Milliseconds: Integer); overload;
    function Add(const TS: TTimeSpan): TTimeSpan; overload;
    function Duration: TTimeSpan;
    function Negate: TTimeSpan;
    function Subtract(const TS: TTimeSpan): TTimeSpan; overload;
    class function FromDays(Value: Double): TTimeSpan; static;
    class function FromHours(Value: Double): TTimeSpan; static;
    class function FromMinutes(Value: Double): TTimeSpan; static;
    class function FromSeconds(Value: Double): TTimeSpan; static;
    class function FromMilliseconds(Value: Double): TTimeSpan; static;
    class function FromTicks(Value: Int64): TTimeSpan; static;
    class function Subtract(const D1, D2: TDateTime): TTimeSpan; overload; static;
    class function Parse(const S: string): TTimeSpan; static;
    class function TryParse(const S: string; out Value: TTimeSpan): Boolean; static;
    class operator Add(const Left, Right: TTimeSpan): TTimeSpan;
    class operator Add(const Left: TTimeSpan; Right: TDateTime): TDateTime;
    class operator Add(const Left: TDateTime; Right: TTimeSpan): TDateTime;
    class operator Subtract(const Left, Right: TTimeSpan): TTimeSpan;
    class operator Subtract(const Left: TDateTime; Right: TTimeSpan): TDateTime;
    class operator Equal(const Left, Right: TTimeSpan): Boolean;
    class operator NotEqual(const Left, Right: TTimeSpan): Boolean;
    class operator GreaterThan(const Left, Right: TTimeSpan): Boolean;
    class operator GreaterThanOrEqual(const Left, Right: TTimeSpan): Boolean;
    class operator LessThan(const Left, Right: TTimeSpan): Boolean;
    class operator LessThanOrEqual(const Left, Right: TTimeSpan): Boolean;
    class operator Negative(const Value: TTimeSpan): TTimeSpan;
    class operator Positive(const Value: TTimeSpan): TTimeSpan;
    class operator Implicit(const Value: TTimeSpan): string;
    class operator Explicit(const Value: TTimeSpan): string;
    property Ticks: Int64 read FTicks;
    property Days: Integer read GetDays;
    property Hours: Integer read GetHours;
    property Minutes: Integer read GetMinutes;
    property Seconds: Integer read GetSeconds;
    property Milliseconds: Integer read GetMilliseconds;
    property TotalDays: Double read GetTotalDays;
    property TotalHours: Double read GetTotalHours;
    property TotalMinutes: Double read GetTotalMinutes;
    property TotalSeconds: Double read GetTotalSeconds;
    property TotalMilliseconds: Double read GetTotalMilliseconds;
    class property MinValue: TTimeSpan read FMinValue;
    class property MaxValue: TTimeSpan read FMaxValue;
    class property Zero: TTimeSpan read FZero;
  end;

C++

struct DECLSPEC_DRECORD TTimeSpan
{
private:
    __int64 FTicks;
private:
    int __fastcall GetDays(void);
    int __fastcall GetHours(void);
    int __fastcall GetMinutes(void);
    int __fastcall GetSeconds(void);
    int __fastcall GetMilliseconds(void);
    double __fastcall GetTotalDays(void);
    double __fastcall GetTotalHours(void);
    double __fastcall GetTotalMinutes(void);
    double __fastcall GetTotalSeconds(void);
    double __fastcall GetTotalMilliseconds(void);
    System::UnicodeString __fastcall ToString(void);
    static TTimeSpan __fastcall GetScaledInterval(double Value, int Scale);
    static TTimeSpan FMinValue;
    static TTimeSpan FMaxValue;
    static TTimeSpan FZero;
    #define TTimeSpan_MillisecondsPerTick  (1.000000E-04)
    #define TTimeSpan_SecondsPerTick  (1.000000E-07)
    #define TTimeSpan_MinutesPerTick  (1.666667E-09)
    #define TTimeSpan_HoursPerTick  (2.777778E-11)
    #define TTimeSpan_DaysPerTick  (1.157407E-12)
    static const System::Word MillisPerSecond = System::Word(0x3e8);
    static const System::Word MillisPerMinute = System::Word(0xea60);
    static const int MillisPerHour = int(0x36ee80);
    static const int MillisPerDay = int(0x5265c00);
    static const __int64 MaxSeconds = 0x000000d6bf94d5e5LL;
    static const __int64 MinSeconds = -0x000000d6bf94d5e5LL;
    static const __int64 MaxMilliseconds = 0x000346dc5d638865LL;
    static const __int64 MinMilliseconds = -0x000346dc5d638865LL;
public:
    static const System::Word TicksPerMillisecond = System::Word(0x2710);
    static const __int64 TicksPerSecond = 0x0000000000989680LL;
    static const __int64 TicksPerMinute = 0x0000000023c34600LL;
    static const __int64 TicksPerHour = 0x0000000861c46800LL;
    static const __int64 TicksPerDay = 0x000000c92a69c000LL;
    __fastcall TTimeSpan(__int64 ATicks)/* overload */;
    __fastcall TTimeSpan(int Hours, int Minutes, int Seconds)/* overload */;
    __fastcall TTimeSpan(int Days, int Hours, int Minutes, int Seconds)/* overload */;
    __fastcall TTimeSpan(int Days, int Hours, int Minutes, int Seconds, int Milliseconds)/* overload */;
#ifndef _WIN64
    TTimeSpan __fastcall Add(const TTimeSpan &TS)/* overload */;
#else /* _WIN64 */
    TTimeSpan __fastcall Add(const TTimeSpan TS)/* overload */;
#endif /* _WIN64 */
    TTimeSpan __fastcall Duration(void);
    TTimeSpan __fastcall Negate(void);
#ifndef _WIN64
    TTimeSpan __fastcall Subtract(const TTimeSpan &TS)/* overload */;
#else /* _WIN64 */
    TTimeSpan __fastcall Subtract(const TTimeSpan TS)/* overload */;
#endif /* _WIN64 */
    static TTimeSpan __fastcall FromDays(double Value);
    static TTimeSpan __fastcall FromHours(double Value);
    static TTimeSpan __fastcall FromMinutes(double Value);
    static TTimeSpan __fastcall FromSeconds(double Value);
    static TTimeSpan __fastcall FromMilliseconds(double Value);
    static TTimeSpan __fastcall FromTicks(__int64 Value);
    static TTimeSpan __fastcall Subtract(const System::TDateTime D1, const System::TDateTime D2)/* overload */;
    static TTimeSpan __fastcall Parse(const System::UnicodeString S);
    static bool __fastcall TryParse(const System::UnicodeString S, /* out */ TTimeSpan &Value);
#ifndef _WIN64
    static TTimeSpan __fastcall _op_Addition(const TTimeSpan &Left, const TTimeSpan &Right);
    static System::TDateTime __fastcall _op_Addition(const TTimeSpan &Left, System::TDateTime Right);
    static System::TDateTime __fastcall _op_Addition(const System::TDateTime Left, const TTimeSpan &Right);
    static TTimeSpan __fastcall _op_Subtraction(const TTimeSpan &Left, const TTimeSpan &Right);
    static System::TDateTime __fastcall _op_Subtraction(const System::TDateTime Left, const TTimeSpan &Right);
    static bool __fastcall _op_Equality(const TTimeSpan &Left, const TTimeSpan &Right);
    static bool __fastcall _op_Inequality(const TTimeSpan &Left, const TTimeSpan &Right);
    static bool __fastcall _op_GreaterThan(const TTimeSpan &Left, const TTimeSpan &Right);
    static bool __fastcall _op_GreaterThanOrEqual(const TTimeSpan &Left, const TTimeSpan &Right);
    static bool __fastcall _op_LessThan(const TTimeSpan &Left, const TTimeSpan &Right);
    static bool __fastcall _op_LessThanOrEqual(const TTimeSpan &Left, const TTimeSpan &Right);
    static TTimeSpan __fastcall _op_UnaryNegation(const TTimeSpan &Value);
    static TTimeSpan __fastcall _op_UnaryPlus(const TTimeSpan &Value);
#else /* _WIN64 */
    static TTimeSpan __fastcall _op_Addition(const TTimeSpan Left, const TTimeSpan Right);
    static System::TDateTime __fastcall _op_Addition(const TTimeSpan Left, System::TDateTime Right);
    static System::TDateTime __fastcall _op_Addition(const System::TDateTime Left, TTimeSpan Right);
    static TTimeSpan __fastcall _op_Subtraction(const TTimeSpan Left, const TTimeSpan Right);
    static System::TDateTime __fastcall _op_Subtraction(const System::TDateTime Left, TTimeSpan Right);
    static bool __fastcall _op_Equality(const TTimeSpan Left, const TTimeSpan Right);
    static bool __fastcall _op_Inequality(const TTimeSpan Left, const TTimeSpan Right);
    static bool __fastcall _op_GreaterThan(const TTimeSpan Left, const TTimeSpan Right);
    static bool __fastcall _op_GreaterThanOrEqual(const TTimeSpan Left, const TTimeSpan Right);
    static bool __fastcall _op_LessThan(const TTimeSpan Left, const TTimeSpan Right);
    static bool __fastcall _op_LessThanOrEqual(const TTimeSpan Left, const TTimeSpan Right);
    static TTimeSpan __fastcall _op_UnaryNegation(const TTimeSpan Value);
    static TTimeSpan __fastcall _op_UnaryPlus(const TTimeSpan Value);
#endif /* _WIN64 */
    __fastcall operator System::UnicodeString();
    __property __int64 Ticks = {read=FTicks};
    __property int Days = {read=GetDays};
    __property int Hours = {read=GetHours};
    __property int Minutes = {read=GetMinutes};
    __property int Seconds = {read=GetSeconds};
    __property int Milliseconds = {read=GetMilliseconds};
    __property double TotalDays = {read=GetTotalDays};
    __property double TotalHours = {read=GetTotalHours};
    __property double TotalMinutes = {read=GetTotalMinutes};
    __property double TotalSeconds = {read=GetTotalSeconds};
    __property double TotalMilliseconds = {read=GetTotalMilliseconds};
    /* static */ __property TTimeSpan MinValue = {read=FMinValue};
    /* static */ __property TTimeSpan MaxValue = {read=FMaxValue};
    /* static */ __property TTimeSpan Zero = {read=FZero};
private:
public:
    TTimeSpan() {}
};

Propriétés

Type Visibilité  Source Unité  Parent
record
struct
public
System.TimeSpan.pas
System.TimeSpan.hpp
System.TimeSpan System.TimeSpan

Description

Décrit un intervalle de temps.

TTimeSpan est une structure de données utilisée pour contenir des informations sur une période de temps. Un objet TTimeSpan peut être un intervalle de temps positif ou négatif, mesuré en jours, heures, minutes, secondes et millisecondes.

Voir aussi