Added a new function to format time with a leading zero
This commit is contained in:
		
							parent
							
								
									5cc7d1403a
								
							
						
					
					
						commit
						4e8a898b26
					
				@ -33,3 +33,19 @@ char *addChar(char *pointer, const char character)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return pointer;
 | 
					    return pointer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					char *dateTimeFormater(char *pointer, const uint8_t value, const char character)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  if(pointer == NULL)
 | 
				
			||||||
 | 
					    return pointer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if(value < 10)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    sprintf(pointer,"%d", value);
 | 
				
			||||||
 | 
					    *(pointer+1) = *(pointer);*(pointer) = character;*(pointer+2) = '\0';
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    sprintf(pointer,"%d", value);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  return pointer;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -66,4 +66,6 @@ typedef struct powerInfo
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
char *addChar(char *pointer, const char character);
 | 
					char *addChar(char *pointer, const char character);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					char *dateTimeFormater(char *pointer, const uint8_t value, const char character);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif //DEFINITION_H
 | 
					#endif //DEFINITION_H
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user