fix: error time clear clipboard
This commit is contained in:
		
							
								
								
									
										10
									
								
								README.MD
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.MD
									
									
									
									
									
								
							@@ -1,7 +1,15 @@
 | 
				
			|||||||
## clipboard-sync
 | 
					## clipboard-sync
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### CommandLineArgs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- `-t` Launch Type
 | 
				
			||||||
 | 
					  - `s` Server
 | 
				
			||||||
 | 
					  - `c` Client
 | 
				
			||||||
 | 
					- `-b` Bind Address (Server Only) Default `:8080`
 | 
				
			||||||
 | 
					- `-a` Server Address(Client Only) Default `http://127.0.0.1:8080`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Server
 | 
					### Server
 | 
				
			||||||
./clipboard-sync -t s
 | 
					./clipboard-sync -t s -b :8080
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Client
 | 
					### Client
 | 
				
			||||||
./clipboard-sync -a http://172.30.34.2:8080
 | 
					./clipboard-sync -a http://172.30.34.2:8080
 | 
				
			||||||
							
								
								
									
										2
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.go
									
									
									
									
									
								
							@@ -69,7 +69,7 @@ func readClipboard(a string) {
 | 
				
			|||||||
				sTime, _ := strconv.ParseInt(response.Header[timeHeader][0], 10, 64)
 | 
									sTime, _ := strconv.ParseInt(response.Header[timeHeader][0], 10, 64)
 | 
				
			||||||
				if sTime > updateTime && sText != old {
 | 
									if sTime > updateTime && sText != old {
 | 
				
			||||||
					old = sText
 | 
										old = sText
 | 
				
			||||||
					updateTime = time.Now().Unix()
 | 
										updateTime = sTime
 | 
				
			||||||
					clipboard.WriteAll(sText)
 | 
										clipboard.WriteAll(sText)
 | 
				
			||||||
					fmt.Printf("Update Clipboard: %s\n", sText)
 | 
										fmt.Printf("Update Clipboard: %s\n", sText)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user