本文整理汇总了PHP中time_str函数的典型用法代码示例。如果您正苦于以下问题:PHP time_str函数的具体用法?PHP time_str怎么用?PHP time_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了time_str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_assign
function show_assign($asgn)
{
$when = time_str($asgn->create_time);
switch ($asgn->target_type) {
case 0:
$x = "All hosts";
break;
case 1:
$x = "<a href=db_action.php?table=host&id={$asgn->id}>Host {$asgn->target_id}</a>";
break;
case 2:
if ($asgn->multi) {
$y = "All hosts belonging to ";
} else {
$y = "One host belonging to ";
}
$x = "{$y}<a href=db_action.php?table=user&id={$asgn->target_id}>Host {$asgn->target_id}</a>";
break;
case 3:
if ($asgn->multi) {
$y = "All hosts belonging to ";
} else {
$y = "One host belonging to ";
}
$x = "{$y}<a href=db_action.php?table=team&id={$asgn->target_id}>Team {$asgn->target_id}</a>";
break;
}
echo "<tr>\n <td>{$asgn->id} (created {$when})</td>\n <td>{$x}</td>\n <td><a href=db_action.php?table=workunit&id={$asgn->workunitid}>{$asgn->workunitid}</a></td>\n <td><a href=db_action.php?table=result&id={$asgn->resultid}>{$asgn->resultid}</a></td>\n </tr>\n ";
}
示例2: send_problem_email
function send_problem_email($user, $host)
{
global $master_url;
$body = "";
$host_content = "ID: " . $host->id . "\n Created: " . time_str($host->create_time) . "\n Venue: " . $host->venue . "\n Total credit: " . $host->total_credit . "\n Average credit: " . $host->expavg_credit . "\n Average update time: " . time_str($host->expavg_time) . "\n IP address: {$host->last_ip_addr} (same the last {$host->nsame_ip_addr} times)\n Domain name: " . $host->domain_name;
$x = $host->timezone / 3600;
if ($x >= 0) {
$x = "+{$x}";
}
$host_content .= "\n Local Time = UTC {$x} hours\n Number of CPUs: " . $host->p_ncpus . "\n CPU: {$host->p_vendor} {$host->p_model}\n FP ops/sec: " . $host->p_fpops . "\n Int ops/sec: " . $host->p_iops . "\n memory bandwidth: " . $host->p_membw . "\n Operating System: {$host->os_name} {$host->os_version}";
$x = $host->m_nbytes / (1024 * 1024);
$y = round($x, 2);
$host_content .= "\n Memory: {$y} MB";
$x = $host->m_cache / 1024;
$y = round($x, 2);
$host_content .= "\n Cache: {$y} KB";
$x = $host->m_swap / (1024 * 1024);
$y = round($x, 2);
$host_content .= "\n Swap Space: {$y} MB";
$x = $host->d_total / (1024 * 1024 * 1024);
$y = round($x, 2);
$host_content .= "\n Total Disk Space: {$y} GB";
$x = $host->d_free / (1024 * 1024 * 1024);
$y = round($x, 2);
$host_content .= "\n Free Disk Space: {$y} GB\n Avg network bandwidth (upstream): {$host->n_bwup} bytes/sec\n Avg network bandwidth (downstream): {$host->n_bwdown} bytes/sec";
$x = $host->avg_turnaround / 86400;
$host_content .= "\n Average turnaround: " . round($x, 2) . " days\n Number of RPCs: {$host->rpc_seqno}\n Last RPC: " . time_str($host->rpc_time) . "\n % of time client on: " . 100 * $host->on_frac . " %\n % of time host connected: " . 100 * $host->connected_frac . " %\n % of time user active: " . 100 * $host->active_frac . " %\n # of results today: " . $host->nresults_today;
$subject = PROJECT . " notice for {$user->name}";
$body = PROJECT . " notification:\n\nDear {$user->name}\nYour machine (host # {$host->id}) described below appears to have a misconfigured BOINC\ninstallation. Could you please have a look at it?\n\nSincerely,\n The " . PROJECT . " team\n";
$body .= "\n\nThis is the content of our database:\n" . $host_content . "\n\nFor further information and assistance with " . PROJECT . " go to {$master_url}";
echo nl2br($body) . "<br><br>";
return send_email($user, $subject, $body);
}
示例3: show_user
function show_user($user)
{
echo "\n <tr class=row1>\n <td>", user_links($user), " (ID {$user->id})</td>\n ";
if ($user->teamid) {
$team = BoincTeam::lookup_id($user->teamid);
echo "\n <td> <a href=team_display.php?teamid={$team->id}>{$team->name}</a> </td>\n ";
} else {
echo "<td><br></td>";
}
echo "\n <td align=right>", format_credit($user->expavg_credit), "</td>\n <td align=right>", format_credit_large($user->total_credit), "</td>\n <td>", $user->country, "</td>\n <td>", time_str($user->create_time), "</td>\n </tr>\n ";
}
示例4: show_delta
function show_delta($delta)
{
global $xml;
$user = BoincUser::lookup_id($delta->userid);
$when = time_str($delta->timestamp);
$what = $delta->joining ? "joined" : "quit";
if ($xml) {
echo " <action>\n <id>{$user->id}</id>\n <name>{$user->name}</name>\n <action>{$what}</action>\n <total_credit>{$delta->total_credit}</total_credit>\n <when>{$when}</when>\n </action>\n";
} else {
echo "<tr>\n <td>{$when}</td>\n <td>", user_links($user), " (ID {$user->id})</td>\n <td>{$what}</td>\n <td>{$delta->total_credit}</td>\n </tr>\n ";
}
}
示例5: show_batches
function show_batches($user)
{
$batches = BoincBatch::enum("user_id={$user->id}");
page_head("Batches");
start_table();
table_header("Batch ID", "Submitted", "# jobs");
foreach ($batches as $batch) {
echo "<tr>\n <td><a href=submit_status.php?action=show_batch&batch_id={$batch->id}>{$batch->id}</a></td>\n <td>" . time_str($batch->create_time) . "</td>\n <td>{$batch->njobs}</td>\n </tr>\n ";
}
end_table();
page_tail();
}
示例6: show_user_row
function show_user_row($user, $i)
{
echo '
<tr class="row1">
<td>$i</td>
<td>' . user_links($user) . '</td>
<td class="right">' . format_credit_large($user->expavg_credit) . '</td>
<td class="right">' . format_credit_large($user->total_credit) . '</td>
<td>' . $user->country . '</td>
<td>' . time_str($user->create_time) . '</td>
</tr>
';
}
示例7: main
function main()
{
echo "------------ Starting at " . time_str(time()) . "-------\n";
$f = fopen("temp.xml", "w");
$teams = BoincTeam::enum(null);
fwrite($f, "<teams>\n");
foreach ($teams as $team) {
handle_team($team, $f);
}
fwrite($f, "</teams>\n");
fclose($f);
if (!rename("temp.xml", "/home/boincadm/boinc/doc/boinc_teams.xml")) {
echo "Rename failed\n";
}
}
示例8: list_files
function list_files($user, $err_msg)
{
$dir = sandbox_dir($user);
$d = opendir($dir);
if (!$d) {
error_page("Can't open sandbox directory");
}
page_head("file sandbox for {$user->name}");
echo "\n <form action=sandbox.php method=post ENCTYPE=\"multipart/form-data\">\n <input type=hidden name=action value=upload_file>\n Upload a file to your sandbox:\n <p><input size=80 type=file name=new_file>\n <p> <input type=submit value=Upload>\n </form>\n <hr>\n ";
if (strcmp($err_msg, "") != 0) {
echo "<p>{$err_msg}<hr>";
}
$files = array();
while (($f = readdir($d)) !== false) {
if ($f == '.') {
continue;
}
if ($f == '..') {
continue;
}
$files[] = $f;
}
if (count($files) == 0) {
echo "Your sandbox is currently empty.";
} else {
sort($files);
start_table();
table_header("Name<br><span class=note>(click to view)</span>", "Modified", "Size (bytes)", "MD5", "Delete", "Download");
foreach ($files as $f) {
$path = "{$dir}/{$f}";
list($error, $size, $md5) = sandbox_parse_link_file($path);
if ($error) {
table_row($f, "Can't parse link file", "", "<a href=sandbox.php?action=delete_files&name={$f}>delete</a>");
continue;
}
$p = sandbox_physical_path($user, $md5);
if (!is_file($p)) {
table_row($f, "Physical file not found", "", "");
continue;
}
$ct = time_str(filemtime($path));
table_row("<a href=sandbox.php?action=view_file&name={$f}>{$f}</a>", $ct, $size, $md5, button_text("sandbox.php?action=delete_file&name={$f}", "Delete"), button_text("sandbox.php?action=download_file&name={$f}", "Download"));
}
end_table();
}
page_tail();
}
示例9: show_view
function show_view($view)
{
if ($view->end_time) {
$d = $view->end_time - $view->start_time;
$dur = "{$d} seconds";
} else {
$dur = "---";
}
if ($view->result_id) {
$result = BoltResult::lookup_id($view->result_id);
$qs = str_replace("action=answer", "action=answer_page", $result->response);
$score = number_format($result->score * 100);
$x = "<br>Score: {$score}%\n\t\t\t<br><a href=bolt_sched.php?{$qs}>Answer page</a>";
}
echo "<tr>\n\t\t<td valign=top>{$view->id}</td>\n\t\t<td valign=top>" . time_str($view->start_time) . "</td>\n\t\t<td valign=top>{$dur}</td>\n\t\t<td valign=top>{$view->item_name}</td>\n\t\t<td valign=top>" . mode_name($view->mode) . " {$x}</td>\n\t";
//<td valign=top>".phase_name($view->phase)."</td>
echo "\n\t\t<td valign=top>" . action_name($view->action) . "</td>\n\t\t</tr>\n\t";
}
示例10: time_str
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// lock all threads older than N days
$cli_only = true;
require_once "../inc/util_ops.inc";
$max_age_days = 90;
// lock threads older than this
if ($argc > 2) {
if ($argv[1] == "--ndays") {
$max_age_days = $argv[2];
}
}
$t = time_str(time());
echo "starting at {$t}\n";
$t = time() - $max_age_days * 86400;
$db = BoincDb::get();
if (!$db) {
die("can't open DB\n");
}
$db->do_query("update " . $db->db_name . ".thread, " . $db->db_name . ".forum set " . $db->db_name . ".thread.locked=1 where " . $db->db_name . ".thread.forum=" . $db->db_name . ".forum.id and " . $db->db_name . ".forum.parent_type=0 and " . $db->db_name . ".thread.timestamp<{$t} and " . $db->db_name . ".thread.locked=0 and " . $db->db_name . ".thread.sticky=0");
$n = $db->affected_rows();
$t = time_str(time());
echo "finished at {$t}; locked {$n} threads\n";
示例11: batches_form
function batches_form($app)
{
page_head("Manage jobs for {$app->name}");
echo "\n <form action=manage_app.php>\n <input type=hidden name=action value=batches_action>\n <input type=hidden name=app_id value={$app->id}>\n ";
start_table();
table_header("Batch ID", "Submitter", "Submitted", "State", "# jobs", "Abort?");
$batches = BoincBatch::enum("app_id={$app->id}");
foreach ($batches as $batch) {
$user = BoincUser::lookup_id($batch->user_id);
echo "<tr>\n <td>{$batch->id}</td>\n <td>{$user->name}</td>\n <td>" . time_str($batch->create_time) . "</td>\n <td>" . batch_state_string($batch->state) . "\n <td>{$batch->njobs}</td>\n <td><input type=checkbox name=abort_{$batch->id}></td>\n </tr>\n ";
}
echo "<tr>\n <td colspan=5>Abort all jobs for {$app->name}?</td>\n <td><input type=checkbox name=abort_all></td>\n </tr>\n ";
echo "<tr>\n <td><br></td>\n <td><br></td>\n <td><br></td>\n <td><input class=\"btn btn-default\" type=submit value=OK></td>\n </tr>\n ";
end_table();
page_tail();
}
示例12: qcn_trigger_detail
function qcn_trigger_detail(&$res, $bg_color, $auth, $user, $bDownloadAll)
{
global $unixtimeArchive;
if ($auth || $user->id == $res->hostid) {
$loc_res = 4;
} else {
$loc_res = 2;
}
// CMC took out hostnamebyid below
$sensor_type = $res->sensor_description;
$archpre = $res->is_archive ? "a" : "r";
// prefix to signify if it's an archive record or not
$file_url = get_file_url($res);
if ($auth) {
if ($bDownloadAll) {
echo "<input type=\"hidden\" name=\"cb_" . $archpre . "_dlfile[]\" id=\"cb_" . $archpre . "_dlfile[]\" value=\"{$res->triggerid}\"" . ">\n";
//echo "<tr><td><input type=\"hidden\" name=\"cb_" . $archpre . "_dlfile[]\" id=\"cb_" . $archpre . "_dlfile[]\" value=\"$res->triggerid\"" .
// "></font size></td></tr>\n";
return;
} else {
echo "\n <tr bgcolor=\"" . $bg_color . "\">\n";
echo "\n <td><font size=\"1\"><input type=\"checkbox\" name=\"cb_" . $archpre . "_reqfile[]\" id=\"cb_" . $archpre . "_reqfile[]\" value=\"{$res->triggerid}\"" . ($res->varietyid != 0 || $res->received_file == 100 || $res->trigger_timereq > 0 || $res->trigger_time < $unixtimeArchive ? " disabled " : " ") . "></font size></td>\n <td><font size=\"1\"><input type=\"checkbox\" name=\"cb_" . $archpre . "_dlfile[]\" id=\"cb_" . $archpre . "_dlfile[]\" value=\"{$res->triggerid}\"" . ($res->received_file != 100 || file_url == "N/A" ? " disabled " : ($bDownloadAll ? " checked " : " ")) . "></font size></td>";
}
}
echo "\n <td><font size=\"1\">{$res->triggerid}</font size></td>";
echo "<td><font size=\"1\"><a href=\"show_host_detail.php?hostid={$res->hostid}\">" . $res->hostid . "</a></font size></td>";
if ($auth) {
echo " <td><font size=\"1\">{$res->ipaddr}<br>{$res->hostname}</font size></td>";
}
// echo "<td><font size=\"1\">$res->result_name</font size></td>";
echo "\n <td><font size=\"1\">" . time_str($res->trigger_time) . "</font size></td>\n <td><font size=\"1\">" . round($res->delay_time, 2) . "</font size></td>\n <td><font size=\"1\">" . time_str($res->trigger_sync) . "</font size></td>\n <td><font size=\"1\">" . round($res->sync_offset, 2) . "</font size></td>\n <td><font size=\"1\">" . round($res->trigger_mag, 2) . "</font size></td>\n <td><font size=\"1\">" . round($res->significance, 2) . "</font size></td>\n <td><font size=\"1\">" . round($res->trigger_lat, $loc_res) . "</font size></td>\n <td><font size=\"1\">" . round($res->trigger_lon, $loc_res) . "</font size></td>\n <td><font size=\"1\">" . ($res->numreset ? $res->numreset : 0) . "</font size></td>\n <td><font size=\"1\">{$res->delta_t}</font size></td>\n <td><font size=\"1\">{$sensor_type}</font size></td>\n <td><font size=\"1\">{$res->sw_version}</font size></td>\n <td><font size=\"1\">{$res->is_geoip}<font size></td>";
echo "\n <td><font size=\"1\">" . time_str($res->trigger_timereq) . "</font size></td>";
// echo" <td><font size=\"1\">" . ($res->received_file == 100 ? " Yes " : " No " ) . "</font size></td>";
if ($file_url != "N/A") {
echo "<td><font size=\"1\"><a href=\"" . $file_url . "\">Download</a></font size></td>";
echo "<td><font size=\"1\"><a href=\"javascript:void(0)\"onclick=\"window.open('" . BASEURL . "/earthquakes/view/view_data.php?dat=" . basename($file_url) . "&fthumb=340','linkname','height=550,width=400,scrollbars=no')\">View</a></font size></td>";
} else {
echo "<td><font size=\"1\">N/A</font size></td>";
echo "<td><font size=\"1\">N/A</font size></td>";
}
if ($res->qcn_quakeid) {
echo "<td><font size=\"1\"><A HREF=\"{$res->quake_url}\">{$res->qcn_quakeid}</A></font size></td>";
echo "<td><font size=\"1\">" . round($res->quake_distance_km, 2) . "</font size></td>";
echo "<td><font size=\"1\">" . round($res->quake_magnitude, 2) . "</font size></td>";
echo "<td><font size=\"1\">" . time_str($res->quake_time) . "</font size></td>";
echo "<td><font size=\"1\">" . round($res->quake_lat, $loc_res) . "</font size></td>";
echo "<td><font size=\"1\">" . round($res->quake_lon, $loc_res) . "</font size></td>";
echo "<td><font size=\"1\">{$res->description}</font size></td>";
// echo "<td><font size=\"1\">$res->guid</font size></td>";
echo "<td><font size=\"1\">" . ($res->is_archive ? "Y" : "N") . "</font size></td>";
} else {
echo "<td><font size=\"1\">N/A</font size></td>";
echo "<td><font size=\"1\"> </font size></td>";
echo "<td><font size=\"1\"> </font size></td>";
echo "<td><font size=\"1\"> </font size></td>";
echo "<td><font size=\"1\"> </font size></td>";
echo "<td><font size=\"1\"> </font size></td>";
echo "<td><font size=\"1\"> </font size></td>";
// echo "<td><font size=\"1\"> </font size></td>";
echo "<td><font size=\"1\">" . ($res->is_archive ? "Y" : "N") . "</font size></td>";
}
echo "</tr>\n ";
}
示例13: show_status_html
function show_status_html($x)
{
page_head(tra("Project status"));
$j = $x->jobs;
$daemons = $x->daemons;
start_table();
echo "<tr><td width=50% valign=top>\n <h2>" . tra("Server status") . "</h2>\n ";
start_table();
table_header(tra("Program"), tra("Host"), tra("Status"));
foreach ($daemons->local_daemons as $d) {
daemon_html($d);
}
foreach ($daemons->remote_daemons as $d) {
daemon_html($d);
}
foreach ($daemons->disabled_daemons as $d) {
daemon_html($d);
}
end_table();
if ($j->db_revision) {
echo tra("Database schema version: "), $j->db_revision;
}
if ($daemons->cached_time) {
echo "<br>Remote daemon status as of ", time_str($daemons->cached_time);
}
if ($daemons->missing_remote_status) {
echo "<br>Status of remote daemons is missing\n";
}
if (function_exists('server_status_project_info')) {
echo "<br>";
server_status_project_info();
}
echo "</td><td>\n";
echo "<h2>" . tra("Computing status") . "</h2>\n";
start_table();
echo "<tr><td>\n";
start_table();
table_header(tra("Work"), "#");
item_html("Tasks ready to send", $j->results_ready_to_send);
item_html("Tasks in progress", $j->results_in_progress);
item_html("Workunits waiting for validation", $j->wus_need_validate);
item_html("Workunits waiting for assimilation", $j->wus_need_assimilate);
item_html("Workunits waiting for file deletion", $j->wus_need_file_delete);
item_html("Tasks waiting for file deletion", $j->results_need_file_delete);
item_html("Transitioner backlog (hours)", number_format($j->transitioner_backlog, 2));
end_table();
echo "</td><td>\n";
start_table();
table_header(tra("Users"), "#");
item_html("With credit", $j->users_with_credit);
item_html("With recent credit", $j->users_with_recent_credit);
item_html("Registered in past 24 hours", $j->users_past_24_hours);
table_header(tra("Computers"), "#");
item_html("With credit", $j->hosts_with_credit);
item_html("With recent credit", $j->hosts_with_recent_credit);
item_html("Registered in past 24 hours", $j->hosts_past_24_hours);
item_html("Current GigaFLOPS", round($j->flops, 2));
end_table();
end_table();
start_table();
echo "<tr><th colspan=5>" . tra("Tasks by application") . "</th></tr>\n";
table_header(tra("Application"), tra("Unsent"), tra("In progress"), tra("Runtime of last 100 tasks in hours: average, min, max"), tra("Users in last 24 hours"));
$i = 0;
foreach ($j->apps as $app) {
$avg = round($app->info->avg, 2);
$min = round($app->info->min, 2);
$max = round($app->info->max, 2);
$x = $max ? "{$avg} ({$min} - {$max})" : "---";
$u = $app->info->users;
echo "<tr class=row{$i}>\n <td>{$app->user_friendly_name}</td>\n <td>{$app->unsent}</td>\n <td>{$app->in_progress}</td>\n <td>{$x}</td>\n <td>{$u}</td>\n </tr>\n ";
$i = 1 - $i;
}
end_table();
echo "<p>Task data as of " . time_str($j->cached_time);
echo "</td></tr>\n";
end_table();
page_tail();
}
示例14: db_init
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// limit a given host to 1 job per day
// TODO: document; use new DB interface
include_once "../inc/db.inc";
include_once "../inc/util.inc";
include_once "../inc/db_ops.inc";
include_once "../inc/util_ops.inc";
include_once "../inc/prefs.inc";
db_init();
if (get_int('hostid')) {
$hostid = get_int('hostid');
} else {
error_page("no hostid");
}
$timestr = time_str(time(0));
$title = "host " . $hostid . " max_results_day set to 1 at " . $timestr;
admin_page_head($title);
if ($hostid > 0) {
$result = _mysql_query("UPDATE host SET max_results_day=1 WHERE id=" . $hostid);
}
echo $title;
admin_page_tail();
示例15: get_error_wus
$row_array = get_error_wus();
$last_update = time();
$cache_data = array('last_update' => $last_update, 'row_array' => $row_array);
set_cached_data($cache_sec, serialize($cache_data), $cache_args);
}
echo "<br/>";
echo "<form method=\"get\" action=\"errorwus.php\">\n";
print_checkbox("Hide canceled WUs", "hide_canceled", $hide_canceled);
print_checkbox("Hide WUs with only d/l errors", "hide_dlerr", $hide_dlerr);
if ($appid) {
echo "<input type=\"hidden\" name=\"appid\" value=\"{$appid}\"/>";
}
echo "<input type=\"hidden\" name=\"level\" value=\"{$notification_level}\"/>";
echo "<input class=\"btn btn-default\" type=\"submit\" value=\"OK\">\n";
echo "</form>\n";
echo "Page last updated " . time_str($last_update);
if (!in_rops()) {
echo "<form action=\"cancel_workunits_action.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"back\" value=\"errorwus\"/>";
}
echo "<br/><table border=\"1\">\n";
echo "<tr><th>WU ID</th><th>WU name</th><th>App ID</th><th>Quorum</th><th>Unsent</th><th>In Progress</th><th>Success</th>";
echo "<th>Download Errors</th><th>Compute Errors</th><th>Validate Errors</th><th>Error mask</th></tr>\n";
$hidden = 0;
foreach ($row_array as $row) {
if ($hide_canceled == 'on' && ($row->error_mask & WU_ERROR_CANCELLED) == WU_ERROR_CANCELLED) {
$hidden++;
continue;
}
if ($hide_dlerr == 'on' && $row->download_errors > 0 && $row->compute_errors == 0 && $row->validate_errors == 0) {
$hidden++;