ZoriaRPG

Time.zh

Jun 21st, 2018
129
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const int TIME_FRAME     = 0;
  2. const int TIME_SEC   = 1;
  3. const int TIME_MINUTE    = 2;
  4. const int TIME_HOUR  = 3;
  5. const int TIME_DAY   = 4;
  6. const int TIME_MONTH     = 5;
  7. const int TIME_YEAR  = 6;
  8. const int TIME_MAX   = 7;
  9.  
  10. int Time[TIME_MAX]={-1, 0, 0, 0, 1, 1, 1};
  11.  
  12. void Do_Time()
  13. {
  14.     int f = ++Time[TIME_FRAME];
  15.     if ( f % 2 )  ++Time[TIME_SEC];
  16.     if ( f >= 60 ) Time[TIME_FRAME] = 0;
  17.     if ( Time[TIME_SEC] > 59 )
  18.     {
  19.         Time[TIME_SEC] = 0;
  20.         ++Time[TIME_MINUTE];
  21.     }
  22.     if ( Time[TIME_MINUTE] > 59 )
  23.     {  
  24.         Time[TIME_MINUTE] = 0;
  25.         ++Time[TIME_HOUR];
  26.     }
  27.     if ( Time[TIME_HOUR] > 23 )
  28.     {
  29.         Time[TIME_HOUR] = 0;
  30.         ++Time[TIME_DAY];
  31.     }
  32.     if ( Time[TIME_DAY] > 30 )
  33.     {
  34.         Time[TIME_DAY] = 1;
  35.         ++Time[TIME_MONTH];
  36.     }
  37.     if ( Time[TIME_MONTH] > 12 )
  38.     {
  39.         Time[TIME_MONTH = 1;
  40.         ++Time[TIME_YEAR];
  41.     }
  42. }
RAW Paste Data