本文整理汇总了C#中Time类的典型用法代码示例。如果您正苦于以下问题:C# Time类的具体用法?C# Time怎么用?C# Time使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Time类属于命名空间,在下文中一共展示了Time类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
Time Now = new Time(12, 34, 56);
Console.WriteLine((int)Now);
Console.WriteLine((double)Now);
Console.WriteLine(Now);
}
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:7,代码来源:Program.cs
示例2: can_extract_time_from_datetime
public void can_extract_time_from_datetime()
{
var compareTime = new Time(13, 59);
var dateTime = new DateTime(2011, 3, 5, 13, 59, 0);
var time = dateTime.TimeOfTheDay();
Assert.AreEqual(time, compareTime);
}
开发者ID:sihugh,项目名称:DateTimeExtensions,代码行数:7,代码来源:TimeTests.cs
示例3: can_parse_time_two_digit_hours
public void can_parse_time_two_digit_hours()
{
var compareTime = new Time(13, 59);
string timeValue = "13:59:00";
var time = timeValue.ToTimeOfDay();
Assert.AreEqual(time, compareTime);
}
开发者ID:sihugh,项目名称:DateTimeExtensions,代码行数:7,代码来源:TimeTests.cs
示例4: AnimatedSprite
public AnimatedSprite(Time frameTime, bool paused, bool looped)
{
FrameTime = frameTime;
Pause = paused;
Loop = looped;
_vertices = new Vertex[4];
}
开发者ID:Tetramputechture,项目名称:Ending_0.1b,代码行数:7,代码来源:AnimatedSprite.cs
示例5: Update
public void Update(Time deltaTime)
{
if (Pause || Animation == null) return;
// add delta time
_currentTime += deltaTime;
// if current time is bigger than frame time, advance one frame
if (_currentTime <= FrameTime) return;
// reset time, but keep remainder
_currentTime = _currentTime % FrameTime;
// get next frame index
if (_currentFrame + 1 < Animation.Frames.Count)
{
_currentFrame++;
}
else
{
// animation has ended
_currentFrame = 0;
if (!Loop)
{
Pause = true;
}
}
SetFrame(_currentFrame, false);
}
开发者ID:Tetramputechture,项目名称:Ending_0.1b,代码行数:31,代码来源:AnimatedSprite.cs
示例6: Main
static void Main()
{
Time Now = new Time(12, 34, 56);
Now.OutTime();
Now["분"] = 19;
Console.WriteLine("분은 {0}입니다.", Now["분"]);
}
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:7,代码来源:Program.cs
示例7: Can_Add_Minutes
public void Can_Add_Minutes()
{
Time time = new Time(22, 30);
time = time.AddMinutes(105);
Assert.AreEqual(0, time.Hour);
Assert.AreEqual(15, time.Minute);
}
开发者ID:ievgeniistepanenko,项目名称:FeetClinic,代码行数:7,代码来源:Time_Tests.cs
示例8: can_format_24hour_time
public void can_format_24hour_time()
{
var compareTime = new Time(13, 59, 58, "HH:mm:ss");
var time = compareTime.ToString();
string timeValue = "13:59:58";
Assert.AreEqual(time, timeValue);
}
开发者ID:kappy,项目名称:DateTimeExtensions,代码行数:7,代码来源:TimeTests.cs
示例9: Constructor
/** == Time units
* Whenever durations need to be specified, eg for a timeout parameter, the duration can be specified
* as a whole number representing time in milliseconds, or as a time value like `2d` for 2 days.
*
* === Using Time units in NEST
* NEST uses `Time` to strongly type this and there are several ways to construct one.
*
* ==== Constructor
* The most straight forward way to construct a `Time` is through its constructor
*/
[U] public void Constructor()
{
var unitString = new Time("2d");
var unitComposed = new Time(2, Nest.TimeUnit.Day);
var unitTimeSpan = new Time(TimeSpan.FromDays(2));
var unitMilliseconds = new Time(1000 * 60 * 60 * 24 * 2);
/**
* When serializing Time constructed from
* - a string
* - milliseconds (as a double)
* - composition of factor and interval
* - a `TimeSpan`
*
* the expression will be serialized to a time unit string composed of the factor and interval e.g. `2d`
*/
Expect("2d")
.WhenSerializing(unitString)
.WhenSerializing(unitComposed)
.WhenSerializing(unitTimeSpan)
.WhenSerializing(unitMilliseconds);
/**
* The `Milliseconds` property on `Time` is calculated even when not using the constructor that takes a double
*/
unitMilliseconds.Milliseconds.Should().Be(1000*60*60*24*2);
unitComposed.Milliseconds.Should().Be(1000*60*60*24*2);
unitTimeSpan.Milliseconds.Should().Be(1000*60*60*24*2);
unitString.Milliseconds.Should().Be(1000*60*60*24*2);
}
开发者ID:niemyjski,项目名称:elasticsearch-net,代码行数:40,代码来源:TimeUnits.doc.cs
示例10: VerifyAllEnums
public void VerifyAllEnums()
{
var acceleration = new Acceleration(1, AccelerationUnit.BaseUnit);
var angle = new Angle(1, AngleUnit.BaseUnit);
var angularAcceleration = new AngularAcceleration(1, AngularAccelerationUnit.BaseUnit);
var area = new Area(1, AreaUnit.BaseUnit);
var density = new MassDensity(1, MassDensityUnit.BaseUnit);
var electricCurrent = new ElectricCurrent(1, ElectricCurrentUnit.BaseUnit);
var electricResistance = new ElectricResistance(1, ElectricResistanceUnit.BaseUnit);
var electricVoltage = new ElectricPotential(1, ElectricPotentialUnit.BaseUnit);
var energy = new Energy(1, EnergyUnit.BaseUnit);
var force = new Force(1, ForceUnit.BaseUnit);
var frequency = new Frequency(1, FrequencyUnit.BaseUnit);
var jerk = new Jerk(1, JerkUnit.BaseUnit);
var length = new Length(1, LengthUnit.BaseUnit);
var mass = new Mass(1, MassUnit.BaseUnit);
var massFlowRate = new MassFlowRate(1, MassFlowRateUnit.BaseUnit);
var momentum = new Momentum(1, MomentumUnit.BaseUnit);
var numeric = new Numeric(1, NumericUnit.BaseUnit);
var power = new Power(1, PowerUnit.BaseUnit);
var pressure = new Pressure(1, PressureUnit.BaseUnit);
var speed = new Speed(1, SpeedUnit.BaseUnit);
var temperature = new Temperature(1, TemperatureUnit.BaseUnit);
var time = new Time(1, TimeUnit.BaseUnit);
var torque = new Torque(1, TorqueUnit.BaseUnit);
var volume = new Volume(1, VolumeUnit.BaseUnit);
var volumetricFlowRate = new VolumetricFlowRate(1, VolumetricFlowRateUnit.BaseUnit);
}
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:28,代码来源:EnumerationVerification.cs
示例11: can_format_12hour_time
public void can_format_12hour_time()
{
var compareTime = new Time(13, 59, 58, "h:mm:ss tt");
var time = compareTime.ToString();
string timeValue = "1:59:58 " + Thread.CurrentThread.CurrentCulture.DateTimeFormat.PMDesignator;
Assert.AreEqual(time, timeValue);
}
开发者ID:kappy,项目名称:DateTimeExtensions,代码行数:7,代码来源:TimeTests.cs
示例12: New
public static StrategyDecision New(
Directive processDirective,
MessageDirective messageDirective,
IEnumerable<ProcessId> affects,
Time pause
) =>
new StrategyDecision(processDirective, messageDirective, affects, pause);
开发者ID:OlduwanSteve,项目名称:language-ext,代码行数:7,代码来源:StrategyDecision.cs
示例13: Report
public Report(Time time, IState state)
{
if(null == state)
throw new ArgumentNullException("state");
_time = time;
_state = state;
}
开发者ID:Shamar,项目名称:FunnyHacks,代码行数:7,代码来源:Report.cs
示例14: Call
public Call (DateTime date, Time time, string dialledPhoneNumber, int duration)
{
this.Date = date;
this.Time = time;
this.DialledPhoneNumber = dialledPhoneNumber;
this.Duration = duration;
}
开发者ID:ReniGetskova,项目名称:CSharp-OOP,代码行数:7,代码来源:Call.cs
示例15: TimeSlot
public TimeSlot(int number, Time startTime, TimeSpan duration, bool isAvailable)
{
Number = number;
StartTime = startTime;
Duration = duration;
IsAvailable = isAvailable;
}
开发者ID:ievgeniistepanenko,项目名称:FeetClinic,代码行数:7,代码来源:TimeSlot.cs
示例16: StrategyContext
StrategyContext(
StrategyState global,
Exception exception,
object message,
ProcessId sender,
ProcessId failedProcess,
ProcessId parentProcess,
IEnumerable<ProcessId> siblings,
IEnumerable<ProcessId> affects,
Time pause,
Option<Directive> directive,
Option<MessageDirective> messageDirective
)
{
bool isStop = directive == LanguageExt.Directive.Stop;
Global = isStop ? StrategyState.Empty : global;
Exception = exception;
Message = message;
Sender = sender;
Self = failedProcess;
ParentProcess = parentProcess;
Siblings = siblings ?? Siblings;
Affects = affects ?? Affects;
Pause = isStop ? 0 * s : pause;
Directive = directive;
MessageDirective = messageDirective;
}
开发者ID:OlduwanSteve,项目名称:language-ext,代码行数:28,代码来源:StrategyContext.cs
示例17: Gregorian
internal Gregorian(Time time, TimeZone timezone)
{
this.time = time;
if (timezone == null)
timezone = time.Context.Gmt ();
this.timezone = timezone;
}
开发者ID:jarlrasm,项目名称:JarlTime,代码行数:7,代码来源:Gregorian.cs
示例18: CreateWIP1
public CreateWIP1(BatchTreeViewItem sender)
{
Sender = sender;
// WorkItem happens after you click
InitializeComponent();
// Do Not Run Until Time
Time timeUntilTime = new Time(false);
dataTableUntil = timeUntilTime.TimeDataTable;
timeUntil.ItemsSource = dataTableUntil.AsDataView();
// Do Not Run After Time
Time timeAfterTime = new Time(false); // heh
dataTableAfter = timeAfterTime.TimeDataTable;
timeAfter.ItemsSource = dataTableAfter.AsDataView();
// Recurrence Interval
Time recurrenceIntervalTime = new Time(true);
dataTableInterval = recurrenceIntervalTime.TimeDataTable;
dataGridInterval.ItemsSource = dataTableInterval.AsDataView();
// Start Window
Time startWindowTime = new Time(true);
dataTableWindow = startWindowTime.TimeDataTable;
dataGridWindow.ItemsSource = dataTableWindow.AsDataView();
Loaded += OnLoaded;
MainWindow.Resize(MainGrid);
}
开发者ID:romitgirdhar,项目名称:azure-batch-samples,代码行数:31,代码来源:CreateWIP1.xaml.cs
示例19: Update
protected override void Update(Time time)
{
sateenkaari.X = (lanta.X + hahmo.X)/2;
sateenkaari.Y = hahmo.Y;
sateenkaari.Width = hahmo.X - lanta.X;
base.Update(time);
}
开发者ID:EA99,项目名称:sejypeli,代码行数:7,代码来源:RainbowFly.cs
示例20: Create
public IRun Create(IComparisonGeneratorsFactory factory)
{
var run = new Run(factory);
var reader = new StreamReader(Stream);
var line = reader.ReadLine();
var titleInfo = line.Split('|');
run.CategoryName = titleInfo[0].Substring(1);
run.AttemptCount = int.Parse(titleInfo[1]);
TimeSpan totalTime = TimeSpan.Zero;
while ((line = reader.ReadLine()) != null)
{
if (line.Length > 0)
{
var majorSplitInfo = line.Split('|');
totalTime += TimeSpanParser.Parse(majorSplitInfo[1]);
while (!reader.EndOfStream && reader.Read() == '*')
{
line = reader.ReadLine();
run.AddSegment(line);
}
var newTime = new Time(run.Last().PersonalBestSplitTime);
newTime.GameTime = totalTime;
run.Last().PersonalBestSplitTime = newTime;
}
else
{
break;
}
}
return run;
}
开发者ID:Rezura,项目名称:LiveSplit,代码行数:34,代码来源:ShitSplitRunFactory.cs
注:本文中的Time类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论