Documentation ¶
Index ¶
- func AppendLineEOF(fname, line string) error
- func CalculateAccuracy(chars int, mistypes int) (float64, error)
- func CalculateWpm(countCh int, secs float64) int
- func CreateDirIfNotExists(dpath string) error
- func CreateFileIfNotExists(fpath string) error
- func FormatDate(t time.Time) string
- func GetHomeDir() (string, error)
- func Tick(t *Timer, forceUpdateChan chan bool, g *gocui.Gui)
- func UpdateUI(g *gocui.Gui)
- func WriteToFile(fpath string, data []byte) error
- type TimeFormatted
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendLineEOF ¶
AppendLineEOF appends a given line to end of a file
func CalculateAccuracy ¶
CalculateAccuracy calculates accuracy in a race based on chars typed so far and mistyped chars
func CalculateWpm ¶
CalculateWpm calculates words per minute based on words typed so far and time elapsed
func CreateDirIfNotExists ¶
CreateDirIfNotExists creates directory path if not exists
func CreateFileIfNotExists ¶
CreateFileIfNotExists creates file if not exists
func FormatDate ¶
FormatDate formats time into DD-MM-YYYY format
func GetHomeDir ¶
GetHomeDir returns absolute path to Home directory
func WriteToFile ¶
WriteToFile writes to a file at a given path
Types ¶
type TimeFormatted ¶
type TimeFormatted struct {
Mins, Secs int
}
TimeFormatted wraps time.Duration converted to mins:seconds format
type Timer ¶
type Timer struct { // used in ticker.go to tick update gocui Ticking bool // contains filtered or unexported fields }
Timer is a stopwatch like functionality Doesn't use ticking mechanism, but keeps tracks of start time to figure the elapsed time
func (*Timer) ElapsedTime ¶
func (t *Timer) ElapsedTime() (*TimeFormatted, error)
ElapsedTime is time the timer has been active for returns error if timer is not active
func (*Timer) ElapsedTimeInSecs ¶
ElapsedTimeInSecs gives elapsed seconds float64 because we could have 1.5sec