```

import sys, termios, tty, select, time

from datetime import datetime


def is_data():

    return select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], [])


def unix_timestamp():

    return int(time.time())


def main():

    fd = sys.stdin.fileno()

    old_settings = termios.tcgetattr(fd)

    try:

        tty.setcbreak(fd)  # cbreak 모드로 설정

        print("Press 'q' to quit")

        while True:

            if is_data():

                ch = sys.stdin.read(1)

                if ch == 'q':

                    print("Quit")

                    break

            now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

            print(now,unix_timestamp())

            time.sleep(1)

    finally:

        termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)


if __name__ == "__main__":

    main()


```