Прочетете на английски Редактиране

Споделяне чрез


PrintSystemJobInfo.UntilTimeOfDay Property

Definition

Gets the last time of day, expressed as the number of minutes after midnight Coordinated Universal Time (UTC) (also called Greenwich Mean Time [GMT]), that the print job can begin printing.

C#
public int UntilTimeOfDay { get; }

Property Value

An Int32 that specifies the last time that the job can print, expressed as the number of minutes after midnight (UTC). The maximum value is 1439.

Examples

The following example shows how to use this property as part of the process of diagnosing a problematic print job.

C#
private static Boolean ReportAvailabilityAtThisTime(PrintSystemJobInfo theJob)
{
    Boolean available = true;
    if (theJob.StartTimeOfDay != theJob.UntilTimeOfDay) // If the job cannot be printed at all times of day
    {
        DateTime utcNow = DateTime.UtcNow;
        Int32 utcNowAsMinutesAfterMidnight = (utcNow.TimeOfDay.Hours * 60) + utcNow.TimeOfDay.Minutes;

        // If "now" is not within the range of available times . . .
        if (!((theJob.StartTimeOfDay < utcNowAsMinutesAfterMidnight) 
           && 
           (utcNowAsMinutesAfterMidnight < theJob.UntilTimeOfDay)))
        {
            available = false;
        }
    }
    return available;
}//end ReportAvailabilityAtThisTime

Remarks

This value is propagated to each PrintSystemJobInfo object from the PrintQueue.UntilTimeOfDay property of the hosting PrintQueue at the time the job enters the queue. If PrintQueue.UntilTimeOfDay is changed, then any PrintSystemJobInfo.UntilTimeOfDay value that is later than PrintQueue.UntilTimeOfDay is changed to the value of PrintQueue.UntilTimeOfDay.

After the job is added to the queue, it can be given a new UntilTimeOfDay value through the Microsoft Windows user interface (UI), provided that it is not later than PrintQueue.UntilTimeOfDay.

If you are not in the UTC time zone, you must add or subtract multiples of 60 to get the correct time for your time zone. For example, if you are in the Pacific Time Zone of North America and daylight savings time is not in effect, then your local time is 8 hours earlier than UTC. If UntilTimeOfDay returns 960, that means 16:00 (4:00 PM) in UTC (because 960/60 = 16). To convert this to Pacific Time, you must subtract 480 (= 8 * 60) minutes.

You also must remember that time rolls over to zero after 24 hours (that is; after the 1439th minute). If UntilTimeOfDay returns 120, that means 2:00 AM in UTC. To convert this to Pacific Time, you must subtract 480 minutes, which results in -360. To get a positive value that has meaning, add the negative number to the total minutes in a day, 1440, resulting in a final value of 1080 (6:00 PM) Pacific Time.

See TimeZone, TimeSpan, and DateTime for methods that help make time-zone adjustments.

If the printer is always available, then this property returns 0 in all time zones.

Applies to

Продукт Версии
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also