VirtualBox

Ignore:
Timestamp:
Nov 23, 2020 10:41:20 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141476
Message:

testmanager/status.py: Unused functions. bugref:9788

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/cgi/status.py

    r86955 r86956  
    4747from testmanager.core.db                import TMDatabaseConnection;
    4848
    49 
    50 
    51 def how_many_days_in_month(year, month):
    52     def leap_year_check(year):
    53         if year % 4 == 0 and year % 100 != 0:
    54             return True
    55         if year % 100 == 0 and year % 400 == 0:
    56             return True
    57         return False
    58 
    59     month31 = (1, 3, 5, 7, 8, 10, 12)
    60     month30 = (4, 6, 9, 11)
    61     if month in month31:
    62         days = 31
    63     elif month in month30:
    64         days = 30
    65     else:
    66         if leap_year_check(year):
    67             days = 29
    68         else:
    69             days = 28
    70     return days
    71 
    72 
    73 def target_date_from_time_span(cur_date, time_span_hours):
    74     cur_year = cur_date.year
    75     cur_month = cur_date.month
    76     cur_day = cur_date.day
    77     cur_hour = cur_date.hour
    78     if cur_hour >= time_span_hours:
    79         return cur_date.replace(hour=cur_hour-time_span_hours)
    80     if cur_day > 1:
    81         return cur_date.replace(day=cur_day-1,
    82                                 hour=24+cur_hour-time_span_hours)
    83     if cur_month > 1:
    84         return cur_date.replace(month=cur_month-1,
    85                                 day=how_many_days_in_month(cur_year, cur_month-1),
    86                                 hour=24+cur_hour-time_span_hours)
    87     return cur_date.replace(year=cur_year-1,
    88                             month=12,
    89                             day=31,
    90                             hour=24+cur_hour-time_span_hours)
    9149
    9250
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette