aboutsummaryrefslogtreecommitdiffstats
path: root/src/protocol/ArgParser.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/ArgParser.cxx')
-rw-r--r--src/protocol/ArgParser.cxx25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx
index 86527c751..e373827b4 100644
--- a/src/protocol/ArgParser.cxx
+++ b/src/protocol/ArgParser.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,6 +20,7 @@
#include "config.h"
#include "ArgParser.hxx"
#include "Result.hxx"
+#include "Chrono.hxx"
#include <limits>
@@ -186,3 +187,25 @@ check_float(Client &client, float *value_r, const char *s)
*value_r = value;
return true;
}
+
+bool
+ParseCommandArg(Client &client, SongTime &value_r, const char *s)
+{
+ float value;
+ bool success = check_float(client, &value, s) && value >= 0;
+ if (success)
+ value_r = SongTime::FromS(value);
+
+ return success;
+}
+
+bool
+ParseCommandArg(Client &client, SignedSongTime &value_r, const char *s)
+{
+ float value;
+ bool success = check_float(client, &value, s);
+ if (success)
+ value_r = SignedSongTime::FromS(value);
+
+ return success;
+}