added a small function to my shellrc
This commit is contained in:
		
							parent
							
								
									56113e423d
								
							
						
					
					
						commit
						2010fd0576
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		
							
								
								
									
										14
									
								
								shellrc
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								shellrc
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -113,6 +113,20 @@ hide-info() {
 | 
			
		|||
unhide-info() {
 | 
			
		||||
	unset hide_info
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
seconds-to-hr() {
 | 
			
		||||
	local seconds d h m s
 | 
			
		||||
	seconds=$1
 | 
			
		||||
	if ((seconds)); then
 | 
			
		||||
		((
 | 
			
		||||
		d=seconds/86400,
 | 
			
		||||
		h=seconds/3600%24,
 | 
			
		||||
		m=seconds/60%60,
 | 
			
		||||
		s=seconds%60
 | 
			
		||||
		))
 | 
			
		||||
		printf '%sd %sh %sm %ss\n' $d $h $m $s
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
# }}}
 | 
			
		||||
if is_zsh; then
 | 
			
		||||
# zsh
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue