Exemplo n.º 1
0
static void handle_tick(struct tm *tick_time, TimeUnits units_changed){  
#ifdef DEBUGTIME
  int hours = get_display_hour(debugHours);
#else
  int hours = get_display_hour(tick_time->tm_hour);
#endif

#ifdef DEBUGTIME
  int minutes = debugMinutes;
#else
  int minutes = tick_time->tm_min;
#endif
  
  update_hours(hours);
  update_minutes(minutes);

#ifdef DEBUGTIME
  ++debugHours;
  if(debugHours > 24){
    debugHours = 1;
  }
  ++debugMinutes;
  if(debugMinutes > 59){
    debugMinutes = 0;
  }    
#endif
  
  //strftime(date_text, sizeof(date_text), dateFormat, tick_time);
  //text_layer_set_text(date_text_layer, date_text);
}
Exemplo n.º 2
0
static void handle_tick(struct tm *tick_time, TimeUnits units_changed) {
  if (units_changed & DAY_UNIT) {
    update_days(tick_time);
  }
  if (units_changed & HOUR_UNIT) {
    update_hours(tick_time);
  }
  if (units_changed & MINUTE_UNIT) {
    update_minutes(tick_time);
  }	
  if (units_changed & SECOND_UNIT) {
    update_seconds(tick_time);
  }		
}
Exemplo n.º 3
0
static void handle_tick(struct tm *tick_time, TimeUnits units_changed) {
	
  if (units_changed & DAY_UNIT) {	  
	  
  static char date_text[] = "XXXX";
	  
    int new_cur_day = tick_time->tm_year*1000 + tick_time->tm_yday;
    if (new_cur_day != cur_day) {
        cur_day = new_cur_day;

	switch(tick_time->tm_mday)
  {
    case 1 :
    case 21 :
    case 31 :
      strftime(date_text, sizeof(date_text), "%est", tick_time);
      break;
    case 2 :
    case 22 :
      strftime(date_text, sizeof(date_text), "%end", tick_time);
      break;
    case 3 :
    case 23 :
      strftime(date_text, sizeof(date_text), "%erd", tick_time);
      break;
    default :
      strftime(date_text, sizeof(date_text), "%eth", tick_time);
      break;
  }
	  text_layer_set_text(layer_date_text, date_text);
		
	}
  }
	
  if (units_changed & HOUR_UNIT) {
   update_hours(tick_time);
  }
  if (units_changed & MINUTE_UNIT) {
   update_minutes(tick_time);
  }
  if (units_changed & SECOND_UNIT) {
    update_seconds(tick_time);
  }			
}
Exemplo n.º 4
0
void tick_handler(struct tm *tick_time, TimeUnits units_changed) {
  
	if (units_changed & MINUTE_UNIT) {
    update_minutes(tick_time);
	}
	if (units_changed & HOUR_UNIT) {
    update_hours(tick_time);
    }
	
	int hour = tick_time->tm_hour;
   
	switch (hour % 12) {
    case 0:
      strcpy(time1_buffer, "twe12e");
	  	  if (swap) {
		        strcpy(time1_buffer, "twelve");
	      }
      break;
    case 1:
      strcpy(time1_buffer, "1ne");
			  	  if (swap) {
		        strcpy(time1_buffer, "one");
	      }
      break;
    case 2:
      strcpy(time1_buffer, "2wo");
			  	  if (swap) {
		        strcpy(time1_buffer, "two");
	      }
      break;
    case 3:
      strcpy(time1_buffer, "3hree");
	    if (swap) {
		        strcpy(time1_buffer, "three");
	      }
      break;
    case 4:
      strcpy(time1_buffer, "4our");
			  	  if (swap) {
		        strcpy(time1_buffer, "four");
	      }
      break;
    case 5:
      strcpy(time1_buffer, "5ive");
			    if (swap) {
		        strcpy(time1_buffer, "five");
	      }
      break;
    case 6:
      strcpy(time1_buffer, "6ix");
	  if (swap) {
		        strcpy(time1_buffer, "six");
	  }
      break;
    case 7:
      strcpy(time1_buffer, "7even");
			  	  if (swap) {
		        strcpy(time1_buffer, "seven");
	      }
      break;
    case 8:
      strcpy(time1_buffer, "8ight");
			  	  if (swap) {
		        strcpy(time1_buffer, "eight");
	      }
      break;
    case 9:
      strcpy(time1_buffer, "9ine");
			  	  if (swap) {
		        strcpy(time1_buffer, "nine");
	      }
      break;
    case 10:
      strcpy(time1_buffer, "10en");
			  	  if (swap) {
		        strcpy(time1_buffer, "ten");
	      }
      break;
    case 11:
      strcpy(time1_buffer, "11even");
			  	  if (swap) {
		        strcpy(time1_buffer, "eleven");
	      }
      break;
  }
  text_layer_set_text(time1_text_layer, time1_buffer);
  
//  if (units_changed & DAY_UNIT) {
    char wday_buffer[4];
    int wday = tick_time->tm_wday;
    switch (wday) {
      case 0:
        strcpy(wday_buffer, "5und4y");
		if (swap) {
		        strcpy(wday_buffer, "sunday");
	      }
        break;
      case 1:
        strcpy(wday_buffer, "m0nd4y");
			  	  if (swap) {
		        strcpy(wday_buffer, "monday");
	      }
        break;
      case 2:
        strcpy(wday_buffer, "tu3sd4y");
			  	  if (swap) {
		        strcpy(wday_buffer, "tuesday");
	      }
        break;
      case 3:
        strcpy(wday_buffer, "w3dn3sd4y");
			  	  if (swap) {
		        strcpy(wday_buffer, "wednesday");
	      }
        break;
      case 4:
        strcpy(wday_buffer, "thur5d4y");
			  	  if (swap) {
		        strcpy(wday_buffer, "thursday");
	      }
        break;
      case 5:
        strcpy(wday_buffer, "fr1d4y");
			  	  if (swap) {
		        strcpy(wday_buffer, "friday");
	      }
        break;
      case 6:
        strcpy(wday_buffer, "54turd4y");
			  	  if (swap) {
		        strcpy(wday_buffer, "saturday");
	      }
        break;
    }
    
//    int mday = tick_time->tm_mday;
	  
    snprintf(date_buffer, sizeof date_buffer, "%s", wday_buffer);
//  }
}