void LCD::displayuserdata_2to5(String id, int picktime , int droptime , String pickstop , String dropstop, int lcd_no) // displays the { int pin = lcd_pin(lcd_no); String _ptime , _dtime ; String _pstop , _dstop; _ptime = adjusted_time(picktime); _dtime = adjusted_time(droptime); LiquidCrystal lcd(pin,pin-2,pin-4,pin-6,pin-8,pin-10,pin-12); lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc. lcd.clear(); lcd.setCursor(0,0); lcd.print(id); // delay(200); lcd.setCursor(12,0); lcd.print(pickstop); // delay(200); /* lcd.setCursor(8,0); lcd.print(droptime); delay(200); */ lcd.setCursor(0,1); lcd.print(_ptime); // delay(200); lcd.setCursor(5,1); lcd.print(_dtime); //delay(200); lcd.setCursor(12,1); lcd.print(dropstop); //delay(200); }
std::string construction::get_time_string() const { const int turns = adjusted_time() / 100; std::string text; if( turns < MINUTES( 1 ) ) { const int seconds = std::max( 1, turns * 6 ); text = string_format( ngettext( "%d second", "%d seconds", seconds ), seconds ); } else { const int minutes = ( turns % HOURS( 1 ) ) / MINUTES( 1 ); const int hours = turns / HOURS( 1 ); if( hours == 0 ) { text = string_format( ngettext( "%d minute", "%d minutes", minutes ), minutes ); } else if( minutes == 0 ) { text = string_format( ngettext( "%d hour", "%d hours", hours ), hours ); } else { const std::string h = string_format( ngettext( "%d hour", "%d hours", hours ), hours ); const std::string m = string_format( ngettext( "%d minute", "%d minutes", minutes ), minutes ); //~ A time duration: first is hours, second is minutes, e.g. "4 hours" "6 minutes" text = string_format( _( "%1$s and %2$s" ), h.c_str(), m.c_str() ); } } text = string_format( _( "Time to complete: %s" ), text.c_str() ); return text; }
int main(int argc, char **argv) { char *cmd = parse_cmdline(argc, argv, NOT_GUI); int rc; char buf[BUFLEN]; struct securid_token *t; rc = common_init(cmd); if (rc != ERR_NONE) die("can't initialize: %s\n", stoken_errstr[rc]); t = current_token; if (!t) die("error: no token present. Use 'stoken import' to add one.\n"); terminal_init(); if (!strcmp(cmd, "tokencode")) { int days_left = securid_check_exp(t, adjusted_time()); if (days_left < 0 && !opt_force) die("error: token has expired; use --force to override\n"); unlock_token(t, 1, NULL); securid_compute_tokencode(t, adjusted_time(), buf); puts(buf); if (days_left < 14 && !opt_force) warn("warning: token expires in %d day%s\n", days_left, days_left == 1 ? "" : "s"); } else if (!strcmp(cmd, "import")) { char *pass; unlock_token(t, 0, &pass); if (!opt_keep_password) { pass = xmalloc(BUFLEN); request_new_pass(pass); } t->is_smartphone = 0; securid_encode_token(t, pass, opt_new_devid, buf); rc = write_token_and_pin(buf, NULL, pass); if (rc != ERR_NONE) die("rcfile: error writing new token: %s\n", stoken_errstr[rc]); } else if (!strcmp(cmd, "export")) { char *pass; unlock_token(t, 0, &pass); if (opt_new_password) pass = opt_new_password; else if (!opt_keep_password) pass = NULL; t->is_smartphone = opt_iphone || opt_android; securid_encode_token(t, pass, opt_new_devid, buf); print_formatted(buf); } else if (!strcmp(cmd, "show")) { unlock_token(t, 0, NULL); securid_token_info(t, &print_token_info_line); } else if (!strcmp(cmd, "setpin")) { char *pass = NULL, pin[BUFLEN], confirm_pin[BUFLEN]; int len; if (opt_file || opt_token) die("error: setpin only operates on the rcfile token\n"); unlock_token(t, 0, &pass); if (opt_new_pin) { if (securid_pin_format_ok(opt_new_pin) != ERR_NONE) die("error: invalid --new-pin format\n"); strncpy(pin, opt_new_pin, BUFLEN); len = strlen(pin); } else { prompt("Enter new PIN: "); len = read_user_input(pin, BUFLEN, 1); if (len > 0 && securid_pin_format_ok(pin) != ERR_NONE) die("error: PIN must be 4-8 digits\n"); prompt("Confirm new PIN: "); read_user_input(confirm_pin, BUFLEN, 1); if (strcmp(pin, confirm_pin) != 0) die("error: PINs do not match\n"); } securid_encode_token(t, pass, NULL, buf); rc = write_token_and_pin(buf, len ? pin : NULL, pass); free(pass); if (rc != ERR_NONE) die("error: can't set PIN: %s\n", stoken_errstr[rc]); } else if (!strcmp(cmd, "setpass")) { char pass[BUFLEN]; unlock_token(t, 0, NULL); request_new_pass(pass); securid_encode_token(t, pass, NULL, buf); /* just print to stdout if it didn't come from the rcfile */ if (opt_file || opt_token) print_formatted(buf); else { rc = write_token_and_pin(buf, strlen(t->pin) ? t->pin : NULL, strlen(pass) ? pass : NULL); if (rc != ERR_NONE) die("error: can't set password: %s\n", stoken_errstr[rc]); } } else die("error: invalid command '%s'\n", cmd); return 0; }