Advertisement
sezenspessa

[SNOBOL 4] EMILY TIME

Jul 14th, 2021 (edited)
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. *****************************************************************
  2. * * Author: Sezen
  3. * * Date: 7/14/21
  4. * * Will update as I learn more SNOBOL4. BASE6 is messy, a branch wasn't working.
  5. *******************************************************************
  6. * * OUTPUTS:
  7. * * STANDARD TIME: 15:55:15
  8. * * EMILY TIME: 35:51:42
  9. *************************************************************************
  10. * * MORE ON EMILY TIME:
  11. * * http://xahlee.info/kbd/happy_hacking_emily.html
  12. *****************************************************************
  13. *
  14. MAIN
  15. *
  16. DEFINE('BASE6(T)NUM') :(BASE6_END)
  17. BASE6
  18. EQ(REMDR(T,6),0) :S(ENDF)
  19. NUM = (REMDR(T,6)) NUM
  20. T = T / 6 :(BASE6)
  21. ENDF
  22. EQ(SIZE(NUM),1) :S(ADD0)F(END1)
  23. ADD0 NUM = 0 NUM
  24. END1 NUM LEN(0) LEN(2) . BASE6 :(RETURN)
  25. BASE6_END
  26. *
  27. OUTPUT = "ENTER A TIME: "
  28. DATE1 = INPUT
  29. DATE1 LEN(0) LEN(2) . CHOUR
  30. DATE1 LEN(3) LEN(2) . CMIN
  31. DATE1 LEN(6) LEN(2) . CSEC
  32. HTEST GE(CHOUR,00) LE(CHOUR,23) :S(MTEST)F(FAIL)
  33. MTEST GE(CMIN,00) LE(CMIN,59) :S(STEST)F(FAIL)
  34. STEST GE(CSEC,00) LE(CSEC,59) :S(GO)F(FAIL)
  35. GO SECS = ((CHOUR * 60) * 60) + (CMIN * 60) + CSEC
  36. DPER = SECS / 86400.0
  37. ETOTAL = CONVERT(DPER * 46656.0,"INTEGER")
  38. EH = CONVERT(ETOTAL / (36.0 * 36.0),"INTEGER")
  39. EM = CONVERT((ETOTAL - (EH * (36.0 * 36.0))) / 36.0,"INTEGER")
  40. ES = REMDR(ETOTAL,36)
  41. OUTPUT = "STANDARD TIME: " DATE1
  42. OUTPUT = "EMILY TIME: " BASE6(EH) ":" BASE6(EM) ":" BASE6(ES) :(END)
  43. FAIL OUTPUT = "BAD TIME, TRY AGAIN!" :(MAIN)
  44. *
  45. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement