Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require 'date'
- # Startzeit und Endzeit festlegen
- time = Time.at(DateTime.parse('07:00:00 +02:00').strftime('%s').to_i)
- endt = Time.at(DateTime.parse('23:00:00 +02:00').strftime('%s').to_i)
- pos = 0.0
- while time < endt
- # Um 07:00 und 15:00 eine neue Spalte beginnen
- if ['0700', '1500'].include? time.strftime('%H%M')
- puts '
- \begin{picture}(92,0)
- '.strip
- end
- # Aktuelle Schreibposition um 5.5mm nach unten verschieben
- pos = pos - 5.5
- # Uhrzeit und Linie malen (Wenn eine Stunde beginnt, Fett drucken)
- print "\\put(0,#{pos}){"
- print "\\textbf{" if time.strftime('%M') == "00"
- print "#{time.strftime('%H:%M')} - #{(time + 600).strftime('%H:%M')}"
- print "}" if time.strftime('%M') == "00"
- puts "}"
- puts "\\put(23,#{pos}){\\line(1,0){67}}"
- # Zeit weiterstellen
- time = time + 600
- # Um 15:00 und 23:00 Spalte beenden
- if ['1500', '2300'].include? time.strftime('%H%M')
- puts '
- \end{picture}
- '.strip
- pos = 0
- end
- end
Add Comment
Please, Sign In to add comment