Mercurial > repo
comparison bin/beat @ 11941:e48305a84ee8 draft
<wob_jonas> fetch bin/beat https://hack.esolangs.org/get/bin/beat
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Fri, 13 Sep 2019 12:14:45 +0000 |
parents | 35d17fa5d3ba |
children | 4642242a7945 |
comparison
equal
deleted
inserted
replaced
11940:35d17fa5d3ba | 11941:e48305a84ee8 |
---|---|
2 # beat - print current time in Swatch Internet Time format. | 2 # beat - print current time in Swatch Internet Time format. |
3 # blame fizzie | 3 # blame fizzie |
4 import math,sys,getopt,time | 4 import math,sys,getopt,time |
5 prec = 0 | 5 prec = 0 |
6 opts,args = getopt.getopt(sys.argv[1:], "hpP:") | 6 opts,args = getopt.getopt(sys.argv[1:], "hpP:") |
7 print(opts) | |
8 for opt,oarg in opts: | 7 for opt,oarg in opts: |
9 if "-p" == opt: prec = 2 | 8 if "-p" == opt: prec = 2 |
10 elif "-P" == opt: prec = int(oarg) | 9 elif "-P" == opt: prec = int(oarg) |
11 elif "-h" == opt: print("Usage: beat [-p]\nPrint current time in Swatch Internet Time format."); sys.exit(2) | 10 elif "-h" == opt: print("Usage: beat [-p]\nPrint current time in Swatch Internet Time format."); sys.exit(2) |
12 else: raise AssertionError() | 11 else: raise AssertionError() |